import { type ErrorInfo, type ReactNode } from 'react'; /** * Error boundary state */ export type ErrorBoundaryState = { hasError: boolean; error: Error | null; errorInfo: ErrorInfo | null; }; /** * Hook for managing error boundary state * * @param fallback - Fallback component or render function * @returns Error boundary component and reset function * * @example * ```tsx * const ErrorBoundary = ({ children }: { children: ReactNode }) => { * const [errorBoundary, resetError] = useErrorBoundary( * ({ error, reset }) => ( * React.createElement('div', null, * React.createElement('h1', null, 'Something went wrong'), * React.createElement('p', null, error?.message), * React.createElement('button', { onClick: reset }, 'Try again') * ) * ) * ); * * return errorBoundary(children); * }; * ``` */ export declare function useErrorBoundary(fallback: (props: { error: Error | null; reset: () => void; }) => ReactNode): [(children: ReactNode) => ReactNode, () => void]; //# sourceMappingURL=useErrorBoundary.d.ts.map