-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to handle/catch errors when rendering components in router #2338
Comments
This is not really React Router specific. You'd catch the component error however you do normally with buggy But otherwise this is no different from if you were rendering the component tree without React Router. |
This seems related: facebook/react#2461 |
How to catch the errors if my render function simply just returns some other children components, and the errors are thrown from the children components? And sometimes the components we use may come from some third party libraries where not all the errors are handled.
And if any error occurs in the children render function,
|
The same way you'd do it without React Router. There's just nothing RR specific here. |
Hi Guys,
When we have errors in a component of the router, the entire tree might get taken down.
For example, in the router below, we have many route paths, and each path is a react component. When rendering any component, if there is an error, the router then gets to a bad state, and any further actions(e.g. a user click a link to render another route component ) may fail.
What would be the work around to catch/handle the errors in component rendering? And is there a way to handle the errors in the components level?
The use case here is:
In a component, I am rendering a basic framework + some other children components. Then I get errors when rendering the children components.
In this scenario, I want to keep the basic framework + render some errors messages to user, so I might need to find a way to handle/catch the errors in the component. Any ideas or suggestions?
The text was updated successfully, but these errors were encountered: