I am getting an error:
Warning: [react-router] It appears you have provided a deprecated history object to
<Router/>
, please use a history provided by React Router withimport { browserHistory } from 'react-router'
orimport { hashHistory } from 'react-router'
. If you are using a custom, valid history please sethistory.__v2_compatible__ = true
. See http://bit.ly/1Pxrl7E
I read the https://github.com/rackt/react-router/blob/master/upgrade-guides/v2.0.0.md#using-history-with-router
It is not clear whether it is discouraged to use history
because of some incompatibilities or if there is another history package that should be used.
I prefer to have router and history packages separate, to promote separation of concerns.
Just found this https://github.com/rackt/react-router/blob/master/upgrade-guides/v2.0.0.md#using-custom-histories
// v2.0.0
import { Router, useRouterHistory } from 'react-router'
import { createHashHistory } from 'history'
// useRouterHistory creates a composable higher-order function
const appHistory = useRouterHistory(createHashHistory)({ queryKey: false })
<Router history={appHistory}/>
Most helpful comment
Just found this https://github.com/rackt/react-router/blob/master/upgrade-guides/v2.0.0.md#using-custom-histories