react-error-boundary
- Version 5.0.0
- Published
- 32.6 kB
- 1 dependency
- MIT license
Install
npm i react-error-boundary
yarn add react-error-boundary
pnpm add react-error-boundary
Overview
Simple reusable React error boundary component
Index
Variables
Functions
Classes
Type Aliases
Variables
variable ErrorBoundaryContext
const ErrorBoundaryContext: any;
Functions
function useErrorBoundary
useErrorBoundary: <TError = any>() => UseErrorBoundaryApi<TError>;
function withErrorBoundary
withErrorBoundary: <T extends ComponentType<any>>( component: T, errorBoundaryProps: ErrorBoundaryProps) => ForwardRefExoticComponent<any>;
Classes
class ErrorBoundary
class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {}
constructor
constructor(props: any);
method componentDidCatch
componentDidCatch: (error: Error, info: ErrorInfo) => void;
method componentDidUpdate
componentDidUpdate: ( prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState) => void;
method getDerivedStateFromError
static getDerivedStateFromError: (error: Error) => { didCatch: boolean; error: Error;};
method render
render: () => any;
method resetErrorBoundary
resetErrorBoundary: (...args: any[]) => void;
Type Aliases
type ErrorBoundaryContextType
type ErrorBoundaryContextType = { didCatch: boolean; error: any; resetErrorBoundary: (...args: any[]) => void;};
type ErrorBoundaryProps
type ErrorBoundaryProps = | ErrorBoundaryPropsWithFallback | ErrorBoundaryPropsWithComponent | ErrorBoundaryPropsWithRender;
type ErrorBoundaryPropsWithComponent
type ErrorBoundaryPropsWithComponent = ErrorBoundarySharedProps & { fallback?: never; FallbackComponent: ComponentType<FallbackProps>; fallbackRender?: never;};
type ErrorBoundaryPropsWithFallback
type ErrorBoundaryPropsWithFallback = ErrorBoundarySharedProps & { fallback: ReactNode; FallbackComponent?: never; fallbackRender?: never;};
type ErrorBoundaryPropsWithRender
type ErrorBoundaryPropsWithRender = ErrorBoundarySharedProps & { fallback?: never; FallbackComponent?: never; fallbackRender: (props: FallbackProps) => ReactNode;};
type FallbackProps
type FallbackProps = { error: any; resetErrorBoundary: (...args: any[]) => void;};
type UseErrorBoundaryApi
type UseErrorBoundaryApi<TError> = { resetBoundary: () => void; showBoundary: (error: TError) => void;};
Package Files (6)
Dependencies (1)
Dev Dependencies (23)
- @babel/preset-env
- @babel/preset-typescript
- @preconstruct/cli
- @types/assert
- @types/jest
- @types/react
- @types/react-dom
- assert
- eslint
- eslint-config-prettier
- eslint-plugin-import
- eslint-plugin-prettier
- eslint-plugin-react
- globals
- jest
- jest-environment-jsdom
- prettier
- react
- react-dom
- rimraf
- ts-jest
- typescript
- typescript-eslint
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/react-error-boundary
.
- Markdown[](https://www.jsdocs.io/package/react-error-boundary)
- HTML<a href="https://www.jsdocs.io/package/react-error-boundary"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3214 ms. - Missing or incorrect documentation? Open an issue for this package.