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

Question: how to get query parameters in route? #18

Open
Bogdaan opened this issue Dec 15, 2015 · 5 comments · May be fixed by #86
Open

Question: how to get query parameters in route? #18

Bogdaan opened this issue Dec 15, 2015 · 5 comments · May be fixed by #86

Comments

@Bogdaan
Copy link

Bogdaan commented Dec 15, 2015

For example i have route "/search" and 100 parameters in app logic, how to pass this in "state"?
Just for process routes like:

/search?form[a]=1&form[b]=1&form[c]=4

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@thehashrocket
Copy link

agreed. i'm looking into the same thing.

@Bogdaan
Copy link
Author

Bogdaan commented Dec 16, 2015

@jshultz as a alternative, you can pass express query string in route state:

await Router.dispatch({
  path: req.path,
  query: req.query,
}, (state, component) => {
...

@aaronkw
Copy link

aaronkw commented Dec 16, 2015

There's an example here that might be useful: https://github.com/kriasoft/react-starter-kit/blob/master/docs/recipes/how-to-implement-routing.md#step-3-parameterized-routes

on('/products/:id', async (req) => {
    const data = await http.get(`/api/products/${req.params.id}`);
    return <Layout><ProductInfo {...data} /></Layout>;
  });

@Bogdaan
Copy link
Author

Bogdaan commented Dec 17, 2015

@aaronkw how it will help process routes with query string (like ?form[a]=1&form[b]=1&form[c]=4)?

@maquessime
Copy link

@Bogdaan thanks for the advice

To clarify, here is the example with the react starter kit : kriasoft/react-starter-kit#355

@frenzzy frenzzy linked a pull request Mar 26, 2017 that will close this issue
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants