Redux Network Middleware
A redux network middleware for handling api call and response.
Installation
yarn add redux-network-middleware
Usage - Api Middleware
; // api middleware with default api clientconst store = ;
Or you can create your own network middleware with custom
; // api middleware with custom api client const api = { return } const store = ;
Example - Basic
Import
;
Constant
// create a async action typeconst FETCH_USER_PROFILE = ;
Action
const fetchUserProfile = type: API_GET payload: endpoin: 'https://example.com/user/' data: id next: FETCH_USER_PROFILE ;
Reducer
const initState = error: null pending: false; const user = { };