React - Error boundaries
Sometimes some unexpected errors and bugs can appear inside our react code. Even when they appear we should prevent our whole application from crashing.
The granularity of error boundaries is up to you. You may wrap top-level route components to display a “Something went wrong” message to the user, just like how server-side frameworks often handle crashes. You may also wrap individual widgets in an error boundary to protect them from crashing the rest of the application.
This mechanizm should not be used to handle exceptions that can be caught in a standard way, but is rather a safety fallback
Create error boundary
I can create an error boundary that will catch unexpected errors inside react code
I can create an error boundary that will catch unexpected errors inside react code