This repository has been archived on 2026-05-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
novarix-networks-homepage/node_modules/next/dist/client/components/catch-error.d.ts
T
Kismet Hasanaj 34dc9aec52 .
2026-05-02 20:07:02 +02:00

45 lines
1.4 KiB
TypeScript

import type { ErrorInfo } from './error-boundary';
import React from 'react';
type UserProps = Record<string, any>;
/**
* `unstable_catchError` is a counterpart to `error.js` that provides a granular
* control of error boundaries at the component level. It provides the `ErrorInfo`
* including `unstable_retry` for error recovery.
*
* Pass a Component-like fallback function that receives the props and `ErrorInfo`.
* The props omit `children` intentionally as it is the "fallback" of the error and
* is not expected to render the children.
*
* This API is must be used inside the client module graph and cannot be imported
* in `server-only` environments like proxy, instrumentation, etc.
*
* @example
* ```tsx
* // CustomErrorBoundary.tsx
* 'use client'
* import { unstable_catchError, type ErrorInfo } from 'next/error'
*
* function CustomErrorBoundary(props: Props, errorInfo: ErrorInfo) {
* return ...
* }
*
* export default unstable_catchError(CustomErrorBoundary)
*
* // page.tsx
* 'use client'
* import CustomErrorBoundary from './CustomErrorBoundary'
*
* export default function Page() {
* return (
* <CustomErrorBoundary>
* ...
* </CustomErrorBoundary>
* )
* }
* ```
*/
export declare function unstable_catchError<P extends UserProps>(fallback: (props: P, errorInfo: ErrorInfo) => React.ReactNode): React.ComponentType<P & {
children?: React.ReactNode;
}>;
export {};