What are the two key lifecycle methods for React Error Boundaries?

Responsive Ad Header

Question

Grade: Education Subject: Support
What are the two key lifecycle methods for React Error Boundaries?
Asked by:
66 Viewed 66 Answers
Responsive Ad After Question

Answer (66)

Best Answer
(259)
The two key lifecycle methods for React Error Boundaries are `getDerivedStateFromError(error)` and `componentDidCatch(error, info)`. `getDerivedStateFromError` returns an object to update state, and `componentDidCatch` is called after an error has been found.