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