react-redux-universal-hot-example
react-redux-universal-hot-example copied to clipboard
Allowing for custom query string parsing
If you enter a URL with a malformed query param (e.g. http://localhost:3000/?key=%) you get a URI malformed error.
On vanilla react-router apps, you can provide a custom query parser to catch these errors.
https://github.com/ReactTraining/react-router/blob/master/upgrade-guides/v2.0.0.md#custom-query-string-parsing
import { useRouterHistory } from 'react-router'
import createBrowserHistory from 'history/lib/createBrowserHistory'
const createAppHistory = useRouterHistory(createBrowserHistory)
const appHistory = createAppHistory({
parseQueryString: () => {
// parse here
},
stringifyQuery: stringify
})
Where would one add custom query string parsing in this boilerplate?