@octanejs/react-error-boundary
v0.1.25
Published
react-error-boundary for Octane, adapted onto Octane's native error boundary.
Readme
@octanejs/react-error-boundary
Octane adapter for the public [email protected] API. It uses
Octane's native @try/@catch boundary rather than shipping another error
catching engine.
import { ErrorBoundary } from '@octanejs/react-error-boundary';
import { getErrorMessage } from '@octanejs/react-error-boundary';
function App() @{
<ErrorBoundary
fallbackRender={({ error, resetErrorBoundary }) =>
<button onClick={() => resetErrorBoundary()}>
{'Retry after ' + (getErrorMessage(error) ?? 'unknown error')}
</button>}
>
<Screen />
</ErrorBoundary>
}fallback, FallbackComponent, fallbackRender, onError, onReset,
resetKeys, ErrorBoundaryContext, getErrorMessage, useErrorBoundary, and
withErrorBoundary are supported.
Errors from event handlers and async callbacks are not render errors; forward
them with useErrorBoundary().showBoundary(error).
For server rendering, import ErrorBoundary from
@octanejs/react-error-boundary/server. That entry deliberately does not catch
descendant errors, matching upstream React server behavior.
