February 2019
Intermediate to advanced
204 pages
4h 52m
English
We can add Saga to our middleware using the following snippet. We can modify the configureStore.js file inside app/configureStore.js as follows:
import { createStore, applyMiddleware, compose } from 'redux';import { fromJS } from 'immutable';import { routerMiddleware } from 'connected-react-router/immutable';import createSagaMiddleware from 'redux-saga';import createReducer from './reducers';const sagaMiddleware = createSagaMiddleware();export default function configureStore(initialState = {}, history) { const middlewares = [sagaMiddleware, routerMiddleware(history)]; const enhancers = [applyMiddleware(...middlewares)]; const store = createStore( createReducer(), fromJS(initialState), compose(...enhancers), ...Read now
Unlock full access