Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Using Error boundry in react app #849

Closed
slim-hmidi opened this issue Nov 13, 2020 · 2 comments
Closed

Using Error boundry in react app #849

slim-hmidi opened this issue Nov 13, 2020 · 2 comments

Comments

@slim-hmidi
Copy link

Hi,
I saw once a video on youtube that you fix an issue on react-error-boundry and I see on your project bookshelf that you use it inside authenticated-app.js.
I'm used to add the ErrorBoundry component code from the react documentation and wrap the main component of my app with it.
What do you think about that? or do you recommend to add it around some specific components or any components that you use in the app or the container components in the project?

@kentcdodds
Copy link
Owner

Hi @slim-hmidi,

Think of ErrorBoundaries like you think of try/catch. If you put a single try/catch around your whole app, how useful is that with regard to the usefulness of the error message and recovery? Not very. But if you put try/catches around specific areas of your app then you can provide much more useful error messages and recover from errors much more easily.

I talk about this in https://EpicReact.Dev :) Good luck!

@slim-hmidi
Copy link
Author

@kentcdodds thanks a lot for this answer. The idea of try/catch makes things more clear for me.
Thanks for youyr time and advice ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants