react-router icon indicating copy to clipboard operation
react-router copied to clipboard

Cannot read property 'getCurrentLocation' of undefined after upgrade from 0.x to 3.0

Open mladenp opened this issue 9 years ago • 5 comments

After updating from 0.x to 3.0.0 i am getting error: Cannot read property 'getCurrentLocation' of undefined in Router.js file.

Line that is causing that issue in Router.js file is:

!history.getCurrentLocation ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'You have provided a history object created with history v2.x or ' + 'earlier. This version of React Router is only compatible with v3 ' + 'history objects. Please upgrade to history v3.x.') : (0, _invariant2.default)(false) : void 0;

mladenp avatar Dec 07 '16 11:12 mladenp

Did you update the history module to v3?

pshrmn avatar Dec 07 '16 16:12 pshrmn

Ah, yes. Thanks. But i found out that 2.8.1 works fine with older history module.

mladenp avatar Dec 07 '16 16:12 mladenp

same problem:

"react-router": "^3.0.2", "history": "^4.5.1",

huanghaiyang avatar Mar 06 '17 07:03 huanghaiyang

@huanghaiyang Your history should be at version 3.5.1 if you're using react-router 3.0.2.

timdorr avatar Mar 06 '17 16:03 timdorr

You are not passing a history to your

<Router history={hashHistory}>

kushal-tech avatar Jun 12 '18 07:06 kushal-tech