lifecycle method
A method of a class component that React calls at a particular moment, such as after mounting, after an update or after an error.
In more detail
Hooks replaced most of them in function components; error boundaries are the main remaining reason to write one. Examples are componentDidMount, componentDidUpdate, componentWillUnmount and componentDidCatch.
Related terms
- class component — The older way to write a React component, as a JavaScript class with a render method and lifecycle methods.
- error boundary — A class component that catches errors thrown while rendering its children and shows a fallback UI instead of crashing the whole app.
Taught in
- Error Boundaries: componentDidCatch And Fallback UI Trees — React 19 & Modern Component Architecture