The Rematch loading plugin
The official loading plugin for Rematch adds automated loading indicators for effects. This plugin means that we don't have to worry about managing states such as loading: true and loading: false by ourselves.
Installing and configuration
To install this plugin, as it is published like the @rematch/core package, you can just use yarn:
yarn add @rematch/loading
This plugin adds just 596 bytes to our application.
The loading plugin accepts one optional argument, which is an object with the following properties:
name: Since this plugin will create a new model for handling all the states of loading our effects, we can overwrite the name of this model. By default, it will be calledloading.type: By default, this plugin keeps track of running effects using Booleans,loading: trueandloading: false, but you can change that behavior and use numbers or even detailed statuses, like "error" or "success". If you use...