redux-state-api-call
Redux state of api call
Installation
npm install --save redux-state-api-call
or
yarn add redux-state-api-call
Usage
Api reducer
The store should know how to handle actions coming from the async actions. To enable this, we need to pass the apiReducer to your store. It serves for all of your async actions ended with _(REQUEST|FAILURE|SUCCESS)
, so you only have to pass it once.
;; const rootReducer = ;
Async Actions
actions.js
;const fetchAllRequest fetchAllFailure fetchAllSuccess } = ;
Selectors
Loading Selector
;; const isFetching = ;
Error Selector
;; const getFetchError = ;