React | Error Boundaries and Debugging | Question 10

Last Updated :
Discuss
Comments

What happens when an error occurs inside a React component?

JavaScript
function App() {
    return (
        <ErrorBoundary>
            <div>{undefinedVar}</div>
        </ErrorBoundary>
    );
}


Error caught, fallback UI shown

App crashes

App re-renders

No UI rendered

Share your thoughts in the comments