Open History to see the last commit
1---
2id: useQueryErrorResetBoundary
3title: useQueryErrorResetBoundary
4redirect_from:
5 - framework/react/reference/useQueryErrorResetBoundary
6---
7β
8<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
9β
10```ts
11function useQueryErrorResetBoundary(): QueryErrorResetBoundaryValue;
12```
13β
14Defined in: [packages/react-query/src/QueryErrorResetBoundary.tsx:102](https://github.com/TanStack/query/blob/main/packages/react-query/src/QueryErrorResetBoundary.tsx#L102)
15β
16This hook will reset any query errors within the closest `QueryErrorResetBoundary`. If there is no boundary
17defined it will reset them globally.
18β
19## Returns
20β
21`QueryErrorResetBoundaryValue`
22β
23The boundary's QueryErrorResetBoundaryValue.
24β
25## Example
26β
27```tsx
28import { ErrorBoundary } from 'react-error-boundary'
29import { useQueryErrorResetBoundary } from '@tanstack/react-query'
30β
31function App({ children }: { children: React.ReactNode }) {
32 const { reset } = useQueryErrorResetBoundary()
33β
34 return (
35 <ErrorBoundary
36 onReset={reset}
37 fallbackRender={({ resetErrorBoundary }) => (
38 <div>
39 There was an error!
40 <button onClick={() => resetErrorBoundary()}>Try again</button>
41 </div>
42 )}
43 >
44 {children}
45 </ErrorBoundary>
46 )
47}
48```