mirror of
https://github.com/TanStack/query.git
synced 2026-11-16 22:50:20 +00:00
React.FC was removed from the create-react-app template in facebook/create-react-app#8177 and is no longer recommended.
715 B
715 B
| id | title |
|---|---|
| useQueryErrorResetBoundary | useQueryErrorResetBoundary |
This hook will reset any query errors within the closest QueryErrorResetBoundary. If there is no boundary defined it will reset them globally:
import { useQueryErrorResetBoundary } from '@tanstack/react-query'
import { ErrorBoundary } from 'react-error-boundary'
const App = () => {
const { reset } = useQueryErrorResetBoundary()
return (
<ErrorBoundary
onReset={reset}
fallbackRender={({ resetErrorBoundary }) => (
<div>
There was an error!
<Button onClick={() => resetErrorBoundary()}>Try again</Button>
</div>
)}
>
<Page />
</ErrorBoundary>
)
}