With React Router 2.0.0rc1-5 I have been getting browserHistory as undefined after import:
import { browserHistory } from 'react-router'
The package seems to be installed correctly, but regardless of the version and whether on server or client, I have gotten the same result.
Maybe this a known bug?
See useRouterHistory: https://github.com/rackt/react-router/blob/master/upgrade-guides/v2.0.0.md#using-custom-histories
I'm using this in server-side:
import {Router, RouterContext, match, useRouterHistory} from 'react-router';
import {createMemoryHistory} from 'history';
// ...
const appHistory = useRouterHistory(createMemoryHistory)({});
const component = (
<Provider store={store} key="provider">
<Router routes={routes} history={appHistory} />
</Provider>
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With