Method 2: componentDidCatch

Let’s understand the purpose of the componentDidCatch method.

We'll cover the following

The componentDidCatch method is called after an error in a descendant component is thrown. Apart from the error thrown, it is passed one more argument which represents more information about the error:

Get hands-on with 1000+ tech skills courses.