A

Admin • 833.24K Points
Coach

Q. How do you handle errors in React components?

  • (A) Using error boundaries with componentDidCatch lifecycle method
  • (B) Using try-catch in render
  • (C) Using useEffect hook
  • (D) React handles errors automatically
  • Correct Answer - Option(A)
  • Views: 28
  • Filed under category React JS
  • Hashtags:

Explanation by: Admin

Error boundaries catch rendering errors and display fallback UI.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.