When an error boundary catches an error, it can use the ________ lifecycle method to specify what should be rendered.

  • getDerivedStateFromError
  • renderErrorBoundary
  • componentDidCatch
  • handleError
When an error boundary catches an error, it can use the getDerivedStateFromError lifecycle method to specify what should be rendered as a fallback UI. This method is used to update the component's state in response to an error. The other options (renderErrorBoundary, componentDidCatch, and handleError) are not standard lifecycle methods in React for this purpose.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *