react-redux-universal-hot-example icon indicating copy to clipboard operation
react-redux-universal-hot-example copied to clipboard

Allowing for custom query string parsing

Open bsadecki opened this issue 9 years ago • 0 comments

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?

bsadecki avatar Dec 16 '16 00:12 bsadecki