Params is empty on root path
See original GitHub issueVersion
react-router-dom: 4.1.1 react-router-config: ^1.0.0-beta.4
Test Case
https://codesandbox.io/s/j14yvr4rr9
Steps to reproduce
navigate to ‘organisation info’
Expected Behavior
params.organisationGuid in Home component is ‘some-organisation-guid’
Actual Behavior
params.organisationGuid in Home component is ‘undefined’
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Params is empty on root path - remix-run/react-router - GitHub
This is expected. params are not global, so they're not available to the ancestor components in the tree where the match occurs.
Read more >The route params is empty - angular - Stack Overflow
However if I add the parent_id I am routing to the root probably because app.routes already defineds :id parameter which is needed in...
Read more >ActivatedRoute - Angular
Provides access to information about a route associated with a component that is loaded in an outlet. Use to traverse the RouterState tree...
Read more >How to handle empty route parameters : r/expressjs - Reddit
Hi Im trying to handle an empty route parameter if a path is not specified , I would like to return a new...
Read more >Params field is empty in $router.push - Laracasts
Hi there, I use this this.$root.$router.push({ path: '/dashboard', params: { errors: 'error' }, query: { test: 'test' } }) in my component to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

That is logically impossible. You can have
<Route>s anywhere in your tree, with their own arbitrary params. There is not one canonical representation of the current<Route>and therefore the currentmatch, only what is closest in the ancestor chain. We no longer have the concept of a central route config.@timdorr I really believe that this should be considered a bug. Not having the params available as a global object seems like a total anti-pattern, considering the URL is available globally. If I have a breadcrumbs component that exists across the entire application and it needs to be able to fetch data on occasion, I have to parse the URL manually when IMO it should inherently be possible while using the router.