Home:ALL Converter>In React with Redux, when should I use syncHistoryWithStore

In React with Redux, when should I use syncHistoryWithStore

Ask Time:2017-01-22T19:59:37         Author:Benjamin Li

Json Formatter

I can see sometimes people just use browserHistory as history, like

import {Router, Route, IndexRoute, browserHistory} from 'react-router'
const router = (
    <Provider store={store}>
        <Router history={browserHistory}>
            <Route path="/" component={App}></Route>
        </Router>
    </Provider>
)

but in some projects, people are using syncHistoryWithStore, like

const history = syncHistoryWithStore(browserHistory, store)

render(
  <Root store={store} history={history} />,
  document.getElementById('root')
)

when should I use the latter? why syncHistoryWithStore is needed?

thanks

Author:Benjamin Li,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/41790614/in-react-with-redux-when-should-i-use-synchistorywithstore
yy