question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clarify query string action to matching route map

See original GitHub issue

I’m trying to add a query parameter to one of my routes, using:

<Link to={{type: 'SEARCH', payload: {find: this.state.findValue /* string */}}}> Blah </Link>

With the route

{
  SEARCH: '/search',
}

Ive also tried adding the query field, dased on these docs:

<Link to={{type: 'SEARCH', payload:  {find: this.state.findValue /* string */}}}> Blah </Link>

As well as adding a dynamic field to my route map:

{
  SEARCH: '/search/:find',
}

But I can’t seem to get RFR to change my query string for me. I have to do something like

{
  SEARCH: '/search?find=:find
}

To get the query string to show up at all. But from your live example it seems that I shouldn’t need to manually code the query string in the route. In addition, I never find my query at store.getState().location.query after I click my link.

So with that all said, what is the proper mapping between what you supply to Link to={…} and what your route looks like in your routes map, in order RFR create the query string for you?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:24 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
Maushundbcommented, Jul 28, 2017

Not yet, it seems that the SSR is getting it right, but the client isn’t for some reason (Turning off JS on the page in dev makes it work!). I’m certainly closer, but I’ll get back to it in the morning. I’m using your demo app as a base if it makes anything come to mind. Thanks for the fast help so far, stoked to get this working!

1reaction
faceyspaceycommented, Jul 28, 2017

oh shit. i totally i forgot about that. my bad. i’ll add it now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to include Query String in the route resolution in order to ...
I need to include the query parameters when it resolves which route. It should match based on whether orderGUID or id is in...
Read more >
Defining Routes - Pedestal
This guide assumes that you understand HTTP requests and URLs. In particular, we make no effort to explain URL-encoding or query strings.
Read more >
Traffic management overview for a global external HTTP(S ...
After a pathMatcher is selected based on the host string, the routeRules in the pathMatcher select a URL path. For more information, see...
Read more >
Listeners for your Application Load Balancers
You can use query string conditions to configure rules that route requests based on key/value pairs or values in the query string. The...
Read more >
URL Dispatch — The Pyramid Web Framework v2.0
When the URL pattern associated with a particular route configuration is matched by a request, a dictionary named matchdict is added as an ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found