React · Middle · Question 15 of 75

Which errors does an error boundary NOT catch?

Explanation

An error boundary catches errors during render, in constructors and in descendants' lifecycle methods. Errors in onClick, setTimeout and promises happen outside render - handle them with try/catch or put them into state to throw during render. A boundary is a class component with getDerivedStateFromError; react-error-boundary is often used.

Further reading

Problem with a question

React · Middle · question 15

Test yourself

Take the React · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz