I've updated react-router
to the latest version - 2.4.1
I use hashHistory in my app
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}/>
And now I'm getting an error
Warning: Using { queryKey: false } no longer works.
Instead, just don't use location state if you don't want a key in your URL query string
How can I fix this?
I don't want additional query key to appear in url. I expect the same behaviour as from angular router or backbone router.
This warning does not actually originate from React Router but the history module it uses. In fact, the latest version (3.0.0, May 30 2016) doesn’t work at all with React Router:
Uncaught Invariant Violation: You have provided a history object created with history v3.x. This version of React Router is not compatible with v3 history objects. Please use history v2.x instead.
This warning is present as of v2.5.1 (Jun 24 2016).
So the easiest solution is to just use the same version React Router uses, courtesy of its package.json
:
"history": "^2.0.1"
After that, the queryKey
option works as expected.
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