For a component to function as an error boundary, it needs to define at least one of the two error handling lifecycle methods, ________ or ________.
- componentDidCatch
- getDerivedStateFromError
- componentWillUnmount
- componentWillMount
A React component can function as an error boundary if it defines at least the componentDidCatch method or the getDerivedStateFromError method. These methods allow the component to catch and handle errors that occur within their children. The other options are not directly related to error boundary functionality.
Loading...