Skip to content

Support for serialized/deserialized query arguments (v4) #4532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mayani opened this issue Feb 14, 2017 · 1 comment
Closed

Support for serialized/deserialized query arguments (v4) #4532

mayani opened this issue Feb 14, 2017 · 1 comment

Comments

@mayani
Copy link
Contributor

mayani commented Feb 14, 2017

Serializing/Deserializing Query Strings

Currently, Link can be assigned query args only as strings using search param. It would be better to extend it to accept objects, which are serialized by the router.

For active Routes, the query args. are only accessible as strings. It would be better to make them accessible as object.

The above was supported in old version at Query Param Example.

Use Case

While using Google Analytics (GA) or any analytics engine, we do not want to record personally identifiable info. in GA, like /user/.
GA provides a way to pre-process URLs using regex, before being recorded. However, if only path params are used, configuring the filter regex becomes tedious, but it is much easier to simply filter out query args. In such cases one would prefer to use query args instead of path args to design there routes.

Examples

<Link to={{
    pathname: "/user",
    search: {
        "username": "[email protected]"
    },
}}>Test</link>
const User = ({ match }) => {
  return <h1>Hello {match.query.username}!</h1>
}
@timdorr
Copy link
Member

timdorr commented Feb 15, 2017

See #4410

@timdorr timdorr closed this as completed Feb 15, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants