Yevhen.Stienin
Yevhen.Stienin

Reputation: 43

history.transitionTo is not a function, created by history/createBrowserHistory

Try to create application with redux, immutable and react-redux-router.

Versions of used packages:

"immutable": "^3.8.2",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-router-redux": "^4.0.8",
"history": "^4.7.2",
"redux": "^3.7.2",
"redux-immutable": "^4.0.0"

I'm creating a history with createSagaMiddleware function from history npm package.

import createHistory from 'history/createBrowserHistory';
const browserHistory: any = createHistory();

But if I pass this instance of the History to the syncHistoryWithStore function for syncing my location and state from store

const history = syncHistoryWithStore(browserHistory, store, {
    selectLocationState: createSelectLocationState()
});

I get following error when I try to navigate to some page:

enter image description here

Because my history object hasn't got a transitionTo function.

Where can I get the History object that is suitable for this task?

Thanks for any help!

Upvotes: 1

Views: 1094

Answers (1)

Slawa Eremin
Slawa Eremin

Reputation: 5415

I think, you should change version of react-router-redux, because "react-router-redux": "^4.0.8" works only with react-router v3, but you use react-router v4(react-router-dom)

npm i react-router-redux@next --save-dev

Upvotes: 1

Related Questions