Loaders
When making network requests that fetch data, you end up writing the same thing over and over again:
- an action to make the request
- an action to handle success
- an action to handle errors
- a reducer to store the data
- a reducer to store the loading state
- a listener to make the request and return the data
The kea-loaders
plugin abstracts this pattern into a system of loaders.
#
InstallationFirst install the kea-loaders
package:
Then install the plugin:
#
Configuration optionsThe plugin takes the following options:
#
Sample usage#
Overriding reducersIn case you need to override project
or projectLoading
, just override the reducers:
In case you want to override the default after the fact, it's not possible to do so by passing
a new default to reducers
. You must instead pass the new default to defaults
For example: