Error boundary that catches both React render errors and unhandled promise rejections.
The unhandledrejection listener lives in the parent component so it remains active
even after the fallback renders (unlike a child-based approach where the listener
unmounts when the error boundary triggers).
Error boundary that catches both React render errors and unhandled promise rejections. The unhandledrejection listener lives in the parent component so it remains active even after the fallback renders (unlike a child-based approach where the listener unmounts when the error boundary triggers).