Skip to content

Commit 90b7891

Browse files
committed
Add createInstance to interfaces.
1 parent 3e13ec3 commit 90b7891

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/interfaces.md

+12
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,15 @@ const props = useFetch(resource, init, options)
4848
- [`options`](options.md) Configuration options
4949

5050
[fetch api]: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Syntax
51+
52+
## `createInstance`
53+
54+
Besides using the `Async` component directly, you can also create your own instance of it. This allows you to preload it
55+
with options, e.g. to enable global error handling.
56+
57+
```js
58+
const CustomAsync = createInstance(defaultProps, displayName)
59+
```
60+
61+
- [`defaultProps`](props.md) Render props object
62+
- `displayName` Name for this instance, used by React DevTools

0 commit comments

Comments
 (0)