react js sagas redux code example
Example 1: install redux saga in react js
import { createStore, applyMiddleware } from 'redux';
import { countReducer } from './counter/reducer';
import createSagaMiddleware from 'redux-saga';
import "regenerator-runtime/runtime";
function* exampleSaga() {
console.log("Example saga reached");
}
const sagaMiddleware = createSagaMiddleware();
export const store = createStore(countReducer, applyMiddleware(sagaMiddleware));
sagaMiddleware.run(exampleSaga);
Example 2: install redux saga in react js
import { createStore, applyMiddleware } from 'redux';
import createSagaMiddleware from 'redux-saga';
import "regenerator-runtime/runtime";
...