erikras / erikras/react-redux-universal-hot-example

Allowing for custom query string parsing

Open
#1,340 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.