kopia lustrzana https://github.com/Tldraw/Tldraw
167 wiersze
2.4 KiB
Markdown
167 wiersze
2.4 KiB
Markdown
---
|
|
title: ErrorBoundary
|
|
status: published
|
|
category: editor
|
|
group: Class
|
|
author: api
|
|
date: 06/23/2023
|
|
order: 31
|
|
---<Small>Public Class</Small>
|
|
|
|
<details>
|
|
<summary>Table of Contents</summary>
|
|
- [Properties](#properties)
|
|
- [state](#ErrorBoundary-state-member)
|
|
- [Methods](#methods)
|
|
- [componentDidCatch](#ErrorBoundary-componentDidCatch-member-1)
|
|
- [getDerivedStateFromError](#ErrorBoundary-getDerivedStateFromError-member-1)
|
|
- [render](#ErrorBoundary-render-member-1)
|
|
</details>
|
|
|
|
|
|
|
|
|
|
##### Signature
|
|
|
|
|
|
```ts
|
|
class ErrorBoundary extends React.Component<
|
|
React.PropsWithRef<React.PropsWithChildren<TLErrorBoundaryProps>>,
|
|
TLErrorBoundaryState
|
|
> {}
|
|
```
|
|
|
|
##### References
|
|
|
|
[React.Component](/gen/@types/react-React-Component-class), [React.PropsWithRef](/gen/@types/react-React-PropsWithRef-type), [React.PropsWithChildren](/gen/@types/react-React-PropsWithChildren-type), [TLErrorBoundaryProps](/gen/editor/TLErrorBoundaryProps-interface), [TLErrorBoundaryState](/gen/editor/~TLErrorBoundaryState-type)
|
|
|
|
---
|
|
|
|
## Properties
|
|
|
|
### `state` \{#ErrorBoundary-state-member}
|
|
|
|
<Small>Public Property</Small>
|
|
|
|
##### Signature
|
|
|
|
|
|
```ts
|
|
state: TLErrorBoundaryState
|
|
```
|
|
|
|
##### References
|
|
|
|
[TLErrorBoundaryState](/gen/editor/~TLErrorBoundaryState-type)
|
|
|
|
---
|
|
|
|
## Methods
|
|
|
|
### `componentDidCatch()` \{#ErrorBoundary-componentDidCatch-member-1}
|
|
|
|
<Small>Public Method</Small>
|
|
|
|
##### Parameters
|
|
|
|
|
|
<ParametersTable>
|
|
|
|
<ParametersTableRow>
|
|
<ParametersTableName>
|
|
|
|
`error`
|
|
|
|
</ParametersTableName>
|
|
<ParametersTableDescription>
|
|
|
|
```ts
|
|
unknown
|
|
```
|
|
|
|
|
|
|
|
</ParametersTableDescription>
|
|
</ParametersTableRow>
|
|
</ParametersTable>
|
|
|
|
##### Returns
|
|
|
|
|
|
```ts
|
|
void
|
|
```
|
|
|
|
---
|
|
|
|
### `getDerivedStateFromError()` \{#ErrorBoundary-getDerivedStateFromError-member-1}
|
|
|
|
<Small>Public Static Method</Small>
|
|
|
|
##### Parameters
|
|
|
|
|
|
<ParametersTable>
|
|
|
|
<ParametersTableRow>
|
|
<ParametersTableName>
|
|
|
|
`error`
|
|
|
|
</ParametersTableName>
|
|
<ParametersTableDescription>
|
|
|
|
```ts
|
|
Error
|
|
```
|
|
|
|
|
|
|
|
</ParametersTableDescription>
|
|
</ParametersTableRow>
|
|
</ParametersTable>
|
|
|
|
##### Returns
|
|
|
|
|
|
```ts
|
|
{
|
|
error: Error
|
|
}
|
|
```
|
|
|
|
##### References
|
|
|
|
[Error](/gen/Error-interface)
|
|
|
|
---
|
|
|
|
### `render()` \{#ErrorBoundary-render-member-1}
|
|
|
|
<Small>Public Method</Small>
|
|
|
|
##### Parameters
|
|
|
|
|
|
None
|
|
|
|
##### Returns
|
|
|
|
|
|
```ts
|
|
| boolean
|
|
| JSX.Element
|
|
| null
|
|
| number
|
|
| React.ReactFragment
|
|
| string
|
|
| undefined
|
|
```
|
|
|
|
##### References
|
|
|
|
[JSX.Element](/gen/@types/react-__global-JSX-Element-interface), [React.ReactFragment](/gen/@types/react-React-ReactFragment-type)
|
|
|
|
---
|
|
|