Warning appear during navigate process to component in <Route component={<Comp />} />?
See original GitHub issueBefore opening a new issue, please take a moment to review our community guidelines to make the contribution process easy and effective for everyone involved.
Description
Warning appears:
index.js:1 Warning: Cannot update a component from inside the function body of a different component.
in Unknown (at loadable.tsx:27)
in Suspense (at loadable.tsx:26)
in Unknown (created by Context.Consumer)
in Route (at App/index.tsx:96)
in Switch (at App/index.tsx:95)
in div (created by styled__MainWrapper)
in styled__MainWrapper (at App/index.tsx:94)
in div (created by styled__AppWrapper)
in styled__AppWrapper (at App/index.tsx:86)
in Unknown (at src/index.tsx:46)
in HelmetProvider (at src/index.tsx:44)
in Router (created by ConnectedRouter)
in ConnectedRouter (created by Context.Consumer)
in ConnectedRouterWithContext (created by ConnectFunction)
in ConnectFunction (at src/index.tsx:43)
in Provider (at src/index.tsx:42)
in ConnectedApp (at src/index.tsx:53)
A clear and concise description of what the bug is. I think lazyLoad is problem Steps to reproduce the behavior:
(Add link to a demo on https://jsfiddle.net or similar if possible)
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
how could I fix this mistake of routes in react - Stack Overflow
In react-router-dom version 6 the Route component API changed significantly, there are no longer component or render props.
Read more >Create a ProtectedRoute for Logged In Users with Route ...
We'll combine a Route with a render prop and use a loggedIn prop to determine if the route ... const ProtectedRoute = ({...
Read more >Route Component - Reach Router
Route Props - These props are passed to your component by Router when your component matches the URL: URL parameters and navigate are...
Read more >A Complete Guide to Routing in React - Hygraph
In this guide, we will learn how to perform routing in React using React router, as well as the various aspects of routing...
Read more >The Guide to Nested Routes with React Router - ui.dev
A solid understanding of how, when, and why to create nested routes is ... With Route out of the way, lets look at...
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

@cuongdevjs you need to use
<Route render={routeProps => <Comp {...routeProps} />} />instead of<Route component={<Comp />} />https://reacttraining.com/react-router/web/api/Route/render-func
well its really an ongoing discussion with no clear reasons. I dont see this error though. Probably related to your setup. If you can find out what the error is and where it originates from let us know with PR