Data Providers uses Redux to handle the
error states of the providers and selectors. This was made due to the great ecosystem of Redux, which allows to easily develop addons to connect that states to any other library or framework, allowing to Data Provider to be focused on solving other problems, as the caches, queries, selectors, etc.
Data Provider implements internally its own Redux store to allow the usage of the library without having to make an extra job creating one for it, but it can be migrated to another store using the
Sets a new Redux store to be used by Data Provider instead of the default one.
store(Redux store): Redux store to be used by Data Provider.
namespace(String): Namespace of the store where Data Provider will keep states of providers and selectors. By default its value is
(Object) Data Provider Redux reducer, ready to be added to your own store using Redux
(Object) Current Data Provider Redux store.
(String) Current namespace in the store where Data Provider keeps states of providers and selectors.
(Object) Direct access to the Data Provider state. Uses Redux
getState method to get all state, and returns all state contents inside the Data Provider current
In this example we are going to see how to tell Data Provider to use one store of your creation instead of the default one. This operation could me made at any moment, as Data Provider migrates all its current state to the new one when the
setStore method is called, but it is strongly recommended to do it at the beginning of the initialization of your app.
As an extra, the example also shows how to initialize Redux devTools in order to improve the front-end developer experience.
Note how the usage of Redux
combineReducersallows you to add your own reducers without any conflict with the Data Provider state.