Skip to content
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

Support for parsing location.search #4414

Closed
kgoggin opened this issue Jan 31, 2017 · 2 comments
Closed

Support for parsing location.search #4414

kgoggin opened this issue Jan 31, 2017 · 2 comments

Comments

@kgoggin
Copy link

kgoggin commented Jan 31, 2017

First off - really loving v4 and the flexibility it provides! Thanks for your hard work!

In the alpha, you could access the parsed search string off of the location object, so that /route?doTheThing=absolutely could be accessed in a route via location.query.doTheThing. Do y'all ever plan to support that in v4, or should I be using some other lib to parse location.search? I've got it working with query-string for now (first parser I found) which works just fine, but it does seem nice to have access to that parsed string via the RR API instead of needing to pull in another dependency. Then again, given the more simplified API in general, I could also see an argument for leaving it up to consumers to choose how they want to handle that string themselves. Or maybe it'd go in as a part of the history API?

Mostly just trying to see if y'all have already made a decision one way or the other. If it's something you'd consider adding, I'd be up for taking a stab at it.

Thanks!

@mjackson
Copy link
Member

Please see the discussion in #4410

@jedwards1211
Copy link

jedwards1211 commented Jul 20, 2018

@kgoggin you may be interested in react-router-parsed, a microlibrary I made that wraps <Route> with parsing logic you specify and injects parsed params and query into the route component.

I have found everything goes more smoothly if I pass in the parsed values to my Route components as props, rather than parsing match.params.whatever or location.search within my Route components.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 18, 2018
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

3 participants