Home
← All questions

Error boundaries — implementation and limitations in React

MediumPremiumReact

Asked at Meta · Microsoft · Stripe

React interview practice: Build an error boundary, explain what it catches, and common production patterns.

Answer

An error boundary is a class component (or library wrapper) that catches JavaScript errors in its child tree during render, lifecycle methods, and constructors — and shows a fallback UI instead of crashing the whole app.

Catches: render errors, lifecycle errors, constructors in child tree.
Does NOT catch: event handlers, async code (setTimeout, promises), SSR errors, errors in the boundary itself.

Premium question

Unlock the full model answer with Mentoxis Premium.

Unlock with Premium