Why you get "Router may have only one child element" warning?

  • Because you have more than one component
  • Because you have more than one child component inside the
  • Because you have multiple routes with the same path
  • Because you have nested components without a parent
In React Router v4, you can get the "Router may have only one child element" warning if you have nested components without a parent . This is because the component renders the first matching child and prevents multiple routes from rendering at the same time. To fix the warning, wrap your components inside a component.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *