question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Could not find router reducer in state tree, it must be mounted under "router"

See original GitHub issue
{
  "private": true,
  "homepage": "https://create-react-app-redux.now.sh",
  "scripts": {
    "deploy": "now && now alias",
    "start": "react-scripts start",
    "now-start": "serve -s ./build",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "precommit": "pretty-quick --staged"
  },
  "devDependencies": {
    "prettier": "1.16.4",
    "react-scripts": "2.1.8"
  },
  "dependencies": {
    "connected-react-router": "6.3.1",
    "react": "16.8.4",
    "react-dom": "16.8.4",
    "react-redux": "6.0.1",
    "react-router": "4.3.1",
    "react-router-dom": "4.3.1",
    "redux": "4.0.1",
    "redux-thunk": "2.3.0",
    "sanitize.css": "8.0.0",
    "serve": "10.1.2",
    "history": "latest"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:8

github_iconTop GitHub Comments

15reactions
progtarekcommented, Jun 27, 2020

In my case I was using history version 5.0.0, I decrease to version 4.10.1, it works fine.

ReactTraining/history#804

9reactions
sengeezercommented, May 13, 2019

@woodyjon What I meant was, try following the module authors’ how to to compare this CRA’s version to their version.

Retracing my commits, what I think I did was:

  • Changed the export statement in the root reducer to the following:
export default (history) => combineReducers({
  router: connectRouter(history),
  counter,
});
  • Changed the call to createStore to:
export default createStore(
  rootReducer(history),
  initialState,
  composedEnhancers
);

I didn’t implement everything as per the medium article. I already had taken a somewhat different approach, so YMMV.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not find router reducer in state tree, it must be mounted ...
The main issue is the version of the history package, with react-router-dom v5 you need to use ...
Read more >
Uncaught Could not find router reducer in state tree, it must be ...
I found a solution. The problem related to version incompatibility. I had this error when using connected-react-router 6.8.0 and react-router ...
Read more >
Error: Could not find router reducer in state tree, it must be ...
I was trying to introduce google auth to my react-redux app for over a week and I was finally able to solve the...
Read more >
Could not find router reducer in state tree, it must be mounted ...
Coding example for the question connectedRouter Error: Could not find router reducer in state tree, it must be mounted under "router"-Reactjs.
Read more >
Could not find router reducer in state tree, it must be ... - Reddit
The above error occurred in the component: in ConnectedRouter in ConnectedRouterWithContext in ConnectFunction in Provider I am stuck in a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found