Not proper props.children value when none of the children routes match within the parent component
See original GitHub issueVersion
4.1.1
Test Case
https://codesandbox.io/s/98m413nxqo
Steps to reproduce
Add a nested route is a component with Switch or multiple Route components within. Now navigate to the nested route but in a such way that none of the children routes will match.
In More details:
Parent Component A which is rendered on route /admin has multiple children routes: /admin/details, /admin/home. If /admin/donotexist is called then Component A will have its props.children resolved to an array of Route React components
Expected Behavior
In case when none of the child routes matched you expect to see props.children to be null.
Actual Behavior
In case when none of the child routes marched it is either Switch component or an array of Route components.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Not proper props.children value when none of the ... - GitHub
Now navigate to the nested route but in a such way that none of the children routes will match. In More details: Parent...
Read more >reactjs - How to update props of child to child component
I'm curious what the LoggedInUser of the app state is. · Well it is meant to be an object, i missdeclareted the string...
Read more >React Children And Iteration Methods - Smashing Magazine
We are using the React.Children.toArray method to ensure that the children prop is always an array. If we do not do that, doing...
Read more >Component interaction - Angular
The parent-child relationship of the components is not established within each component's respective class with the local variable technique. Because the class ...
Read more >Angular Router: Child Routes, Auxiliary Routes, Master Detail
Learn how to use the Angular Router, avoid common pitfalls, learn Child Routes, Auxiliary Routes, setup a Master Detail Routing Scenario.
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

I’m not sure what you’re doing differently, but that’s not what I see:
So for those who is still looking for a solution to this problem. This is a kinda way I managed to solve this in
react-router v4.So for the old
v2code:I converted into the following code: