Skip to content

Commit 0edfc1c

Browse files
committed
Added instructions for using new HOC
1 parent b81dae9 commit 0edfc1c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@ import ErrorBoundary from 'react-error-boundary';
1313
</ErrorBoundary>
1414
```
1515

16-
You can also react to errors (eg for logging) by providing an `onError` callback:
16+
You can also use it as a HOC:
17+
18+
```jsx
19+
import {withErrorBoundary} from 'react-error-boundary';
20+
21+
const ComponentWithErrorBoundary = withErrorBoundary(YourComponent);
22+
```
23+
24+
You can react to errors (eg for logging) by providing an `onError` callback:
1725

1826
```jsx
1927
import ErrorBoundary from 'react-error-boundary';

0 commit comments

Comments
 (0)