Skip to content
Advertisement

Please change the parent to

I’m getting this warning in React app:

JavaScript

Here is my code:

JavaScript

AppBody.js:

JavaScript

What I’ve to change in my code to fix the warning?

Advertisement

Answer

It means that AppBody is rendering more deeply nested routes and the path needs to specify the wildcard * character to indicate it can match more generic/nested paths. react-router-dom route paths are always exactly matched, so if sub-routes are rendered the path needs to allow for them. Change path="/" to path="/*".

Since AppBody is rendering the routes and no Outlet for the nested Route components, they can be safely removed.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement