Your website crashing and disaplying a white screen is not something you want
React 16+ offers error boundaries to help you take care of those cases
React official docs
However error boundaries are limited in catching errors.
are not handled.
The react-error-boundary allows you to use this error boundary without having to implement everything yourself and also can be used to catch arrors in event handlers and asynchronous code.