React · Senior · Question 69 of 75
How do you let users retry after an error boundary shows a fallback?
- ✓Correct answer: Reset the boundary's state (e.g. via
react-error-boundary'sresetErrorBoundaryor changing itskey) - 2Reload the whole page with
location.reload() - 3Error boundaries reset automatically after 5 seconds
Explanation
Built-in error boundaries are class components; the react-error-boundary library adds hooks, reset keys and onReset to refetch or clear bad state.