react router saga code example
Example: react-router in saga
import {createBrowserHistory} from 'history'
export default createBrowserHistory({your_config_here})
import {... call} from 'redux-saga/effects'
import history from './history'
export default function* your_root_saga(){
...access history here or in your sub sagas...
yield call([history, history.push], 'your_object_path')
}
import history from './history'
import {Router, ...} from 'react-router-dom'
import your_root_saga from './sagas'
import {createSagaMiddleware} from 'redux-saga'
const sagaMiddleware = createSagaMiddleware()
...config_your_store_here...
sagaMiddleware.run(your_root_saga)
render( <Router history = {history}> ... </Router>
, document.getElementById('elementId'))