> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# Function: useErrorBoundary()

> **useErrorBoundary**(`callback?`: (`error`: `any`, `errorInfo`: `ErrorInfo`) => `void` | `Promise`\<`void`>): \[`any`, () => `void`]

Catches errors thrown by the components below and lets the component
render a fallback.

## Parameters

| Parameter   | Type                                                                       |
| ----------- | -------------------------------------------------------------------------- |
| `callback?` | (`error`: `any`, `errorInfo`: `ErrorInfo`) => `void` \| `Promise`\<`void`> |

## Returns

\[`any`, () => `void`]

## See

[https://preactjs.com/guide/v10/hooks/#useerrorboundary](https://preactjs.com/guide/v10/hooks/#useerrorboundary)
