React-router: Explain "It appears you have provided a deprecated history object to" __v2_compatible__

Created on 7 Jan 2016  路  1Comment  路  Source: ReactTraining/react-router

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 with import { browserHistory } from 'react-router' or import { hashHistory } from 'react-router'. If you are using a custom, valid history please set history.__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.

Most helpful comment

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}/>

>All comments

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}/>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

davetgreen picture davetgreen  路  3Comments

sarbbottam picture sarbbottam  路  3Comments

wzup picture wzup  路  3Comments

stnwk picture stnwk  路  3Comments

ArthurRougier picture ArthurRougier  路  3Comments