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