E
E
evgenin2021-12-18 00:26:32
React
evgenin, 2021-12-18 00:26:32

How to show errors in React instead of white screen?

After npm run watch, no errors are shown on the screen, just in the console, how can I show the errors on the screen? Apart from the componentDidCatch and getDerivedStateFromError methods? So that the errors were only in the dev version were shown?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2021-12-18
@evgenin

https://www.npmjs.com/package/react-error-overlay
This utility is part of create-react-app, it shows errors quite nicely.
You will need to configure it with handles, or try switching to create-react-app - there is a whole lot of everything out of the box.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question