history: React router with redux not working after updrage to 5.0.0

Hello, Im trying to setup a react redux boilerplate that uses the react router with redux and connected-react-router and rely on the createBrowserHistory api from the history package. everything was working fine, until i made the upgrade to 5.0.0 for it then it stopped working throwing the following error in the console when i click on a <Link /> Uncaught Could not find router reducer in state tree, it must be mounted under "router" PS : I’m already mounting the router reducer in my root reducer.

https://www.loom.com/share/d956b05939af4fada2ec891ae56c8853

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 62
  • Comments: 18

Commits related to this issue

Most upvoted comments

Documentation for migrating from 4 -> 5 would be helpful.

Same issue here. Downgrading to 4.10.1 fixes the issue.

Im also having this problem!

feels weird that history v5 is at @latest while react-router-dom v6 is at @next

You probably have to update to the react router v6 alpha as well, as the v5 is explicity specifying v4 history in its dependencies. More likely than not, you will have two (conflicting) history deps if you are still using react-router 5.

EDIT: I am having issues with connected-react-router, sorry I commented in wrong repo, see https://github.com/supasate/connected-react-router/issues/429

I found i am getting a Could not find router reducer in state tree, it must be mounted under "router", i traced it down to the missing action prop on the persisted route object, as @readikus mentioned above.

in selectors.js, there is code looking for it when validating if it is a router:

var isRouter = function isRouter(value) {
  return value != null && _typeof(value) === 'object' && getIn(value, ['location']) && getIn(value, ['action']);
};

Documentation for version 5 can be found in the docs directory. This is the current stable release. Version 5 is used in React Router version 6.

Documentation for version 4 can be found on the v4 branch. Version 4 is used in React Router versions 4 and 5.

@avindra I did actually try upgrading the router to v6 before checking here but I am still having the same issues as marked here. But it may be more an issue with connected-react-router. Personally I will wait to upgrade until the package that is causing it becomes more clear.