Open History to see the last commit
1---
2id: QueryErrorResetBoundary
3title: QueryErrorResetBoundary
4redirect_from:
5 - framework/react/reference/QueryErrorResetBoundary
6---
7β
8<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
9β
10```ts
11function QueryErrorResetBoundary(props: QueryErrorResetBoundaryProps): Element;
12```
13β
14Defined in: [packages/react-query/src/QueryErrorResetBoundary.tsx:160](https://github.com/TanStack/query/blob/main/packages/react-query/src/QueryErrorResetBoundary.tsx#L160)
15β
16When using `suspense` or `throwOnError` in your queries, you need a way to let queries know that you want to
17try again when re-rendering after some error occurred. With the `QueryErrorResetBoundary` component you can
18reset any query errors within the boundaries of the component.
19β
20## Parameters
21β
22### props
23β
24[`QueryErrorResetBoundaryProps`](../interfaces/QueryErrorResetBoundaryProps.md)
25β
26The `children` to render.
27β
28<a id="props-properties"></a>
29β
30#### `props` properties
31β
32| Property | Type | Description |
33| ------ | ------ | ------ |
34| <a id="props-property-children"></a> `children` | \| `ReactNode` \| [`QueryErrorResetBoundaryFunction`](../type-aliases/QueryErrorResetBoundaryFunction.md) | Either a plain node, or a function that receives the boundary's QueryErrorResetBoundaryValue and returns a node. |
35β
36## Returns
37β
38`Element`
39β
40The `children`, rendered as-is, or called with the boundary's QueryErrorResetBoundaryValue
41if `children` is a function.
42β
43## Example
44β
45```tsx
46import { ErrorBoundary } from 'react-error-boundary'
47import { QueryErrorResetBoundary } from '@tanstack/react-query'
48β
49function App() {
50 return (
51 <QueryErrorResetBoundary>
52 {({ reset }) => (
53 <ErrorBoundary
54 onReset={reset}
55 fallbackRender={({ resetErrorBoundary }) => (
56 <div>
57 There was an error!
58 <button onClick={() => resetErrorBoundary()}>Try again</button>
59 </div>
60 )}
61 >
62 <Page />
63 </ErrorBoundary>
64 )}
65 </QueryErrorResetBoundary>
66 )
67}
68```