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