Created
October 26, 2025 15:22
-
-
Save sriram-palanisamy-hat/6976aa98980b7c550ab64b4236a33aab to your computer and use it in GitHub Desktop.
Which Error Boundary catches the error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from 'react'; | |
| function App() { | |
| return ( | |
| <ErrorBoundary name="boundary-1"> | |
| <A /> | |
| </ErrorBoundary> | |
| ) | |
| } | |
| function renderWithError() { | |
| console.log('throw') | |
| throw new Error('error'); | |
| } | |
| function A() { | |
| return <ErrorBoundary name="boundary-2"> | |
| {renderWithError()} | |
| </ErrorBoundary>; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment