-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Closed
Description
I may have run into a small documentation error regarding custom query string parsing in V2:
I think instead of what's listed there for V2 we actually need to use a custom history like in https://github.com/rackt/react-router/blob/master/upgrade-guides/v2.0.0.md#using-custom-histories.
So, changing this:
// v1.x
<Router
parseQueryString={parse}
stringifyQueryString={stringify}
/>
// v2.0.0
import { useRouterHistory, browserHistory } from 'react-router'
const createAppHistory = useRouterHistory(browserHistory)
const appHistory = createAppHistory({
parseQueryString: parse,
stringifyQueryString: stringify
})
<Router history={appHistory}/>
to
// v1.x
<Router
parseQueryString={parse}
stringifyQueryString={stringify}
/>
// v2.0.0
import { useRouterHistory } from 'react-router'
import createBrowserHistory from 'history/lib/createBrowserHistory'
const createAppHistory = useRouterHistory(createBrowserHistory)
const appHistory = createAppHistory({
parseQueryString: parse,
stringifyQueryString: stringify
})
<Router history={appHistory}/>
I'm happy to make a PR with the changes, but I just wanted to make sure I'm not off base here.
Thanks for all of your work!
Metadata
Metadata
Assignees
Labels
No labels