connected-react-router

What is the “key” which changes on every route change with connected-react-router?

二次信任 提交于 2021-02-20 07:47:31
问题 When an action for navigating to a route is triggered, an action triggers a new state where the router.location.pathname changes according to the browser's history . Another property changes as well: router.location.key , to a new random string. Even when the pathname itself doesn't change (clicking on a link to a page from the page itself), the key still updates. What's the purpose of the key property? In which situations would I want my own state to have a randomly generated key which

What is the “key” which changes on every route change with connected-react-router?

為{幸葍}努か 提交于 2021-02-20 07:47:13
问题 When an action for navigating to a route is triggered, an action triggers a new state where the router.location.pathname changes according to the browser's history . Another property changes as well: router.location.key , to a new random string. Even when the pathname itself doesn't change (clicking on a link to a page from the page itself), the key still updates. What's the purpose of the key property? In which situations would I want my own state to have a randomly generated key which

“Could not find router reducer” error when using connected-react-router

浪尽此生 提交于 2020-08-20 02:04:09
问题 I repeatedly get a Could not find router reducer in state tree, it must be mounted under "router" error when I do a dispatch(push("/")); call. index.tsx const store = configureStore(); ReactDOM.render( <Provider store={store}> <ConnectedRouter history={history}> <Switch> <Route exact path="/" component={HomeScreenContainer} /> <Route exact path="/login" component={LoginScreenContainer} /> </Switch> </ConnectedRouter> </Provider>, document.getElementById('root'), ); configureStore.ts export