Open History to see the last commit
1---
2id: useQueryErrorResetBoundary
3title: useQueryErrorResetBoundary
4---
5β
6This hook will reset any query errors within the closest `QueryErrorResetBoundary`. If there is no boundary defined it will reset them globally:
7β
8```tsx
9import { useQueryErrorResetBoundary } from '@tanstack/react-query'
10import { ErrorBoundary } from 'react-error-boundary'
11β
12const App: React.FC = () => {
13 const { reset } = useQueryErrorResetBoundary()
14 return (
15 <ErrorBoundary
16 onReset={reset}
17 fallbackRender={({ resetErrorBoundary }) => (
18 <div>
19 There was an error!
20 <Button onClick={() => resetErrorBoundary()}>Try again</Button>
21 </div>
22 )}
23 >
24 <Page />
25 </ErrorBoundary>
26 )
27}
28```