Skip to content

Commit

Permalink
Update README.md (#180)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Brian Vaughn <[email protected]>
  • Loading branch information
Erasmus001 and bvaughn authored Feb 1, 2024
1 parent ed6d112 commit 15f1ba2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ yarn add react-error-boundary
## API

### `ErrorBoundary` component
Wrap an `ErrorBoundary` around other React components to "catch" errors and render a fallback UI. The component supports several ways to render a fallback (shown below).
Wrap an `ErrorBoundary` component around other React components to "catch" errors and render a fallback UI. The component supports several ways to render a fallback (as shown below).

> **Note** `ErrorBoundary` is a _client_ component. You can only pass props to it that are serializeable or use it in files that have a `"use client";` directive.
#### `ErrorBoundary` with `fallback` prop
The simplest way to render a default "something went wrong" type error message.
The simplest way to render a default "something went wrong" type of error message.
```js
"use client";

Expand Down Expand Up @@ -142,7 +142,7 @@ function Example() {
```

#### Dismiss the nearest error boundary
A fallback component can use this hook to request the nearest error boundary retry the render that original failed.
A fallback component can use this hook to request the nearest error boundary retry the render that originally failed.

```js
"use client";
Expand Down Expand Up @@ -211,4 +211,4 @@ If using Yarn:

---

[This blog post](https://kentcdodds.com/blog/use-react-error-boundary-to-handle-errors-in-react) shows more examples of how this package can be used, although it was written for the [version 3 API](https://github.com/bvaughn/react-error-boundary/releases/tag/v3.1.4).
[This blog post](https://kentcdodds.com/blog/use-react-error-boundary-to-handle-errors-in-react) shows more examples of how this package can be used, although it was written for the [version 3 API](https://github.com/bvaughn/react-error-boundary/releases/tag/v3.1.4).

0 comments on commit 15f1ba2

Please sign in to comment.