mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
Fix React Router not updating routes
https://github.com/ReactTraining/react-router/issues/4671
This commit is contained in:
parent
5d32f57696
commit
08952bc4fd
1 changed files with 7 additions and 1 deletions
|
|
@ -131,4 +131,10 @@ Routes.propTypes = {
|
|||
|
||||
const mapStateToProps = state => ({ isAuthenticated: state.Auth.isAuthenticated });
|
||||
|
||||
export default compose(connect(mapStateToProps), withRouter, withFlattenedRoutes)(Routes);
|
||||
// Note: it is important that the withRouter HOC is **outside** the
|
||||
// connect HOC, otherwise React Router won't rerender any Route
|
||||
// components since connect implements a shouldComponentUpdate
|
||||
// lifecycle hook.
|
||||
//
|
||||
// See: https://github.com/ReactTraining/react-router/issues/4671
|
||||
export default compose(withRouter, connect(mapStateToProps), withFlattenedRoutes)(Routes);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue