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.
889 B
889 B
| id | title |
|---|---|
| QueryErrorResetBoundary | QueryErrorResetBoundary |
When using suspense or throwOnError in your queries, you need a way to let queries know that you want to try again when re-rendering after some error occurred. With the QueryErrorResetBoundary component you can reset any query errors within the boundaries of the component.
import { QueryErrorResetBoundary } from '@tanstack/react-query'
import { ErrorBoundary } from 'react-error-boundary'
const App = () => (
<QueryErrorResetBoundary>
{({ reset }) => (
<ErrorBoundary
onReset={reset}
fallbackRender={({ resetErrorBoundary }) => (
<div>
There was an error!
<Button onClick={() => resetErrorBoundary()}>Try again</Button>
</div>
)}
>
<Page />
</ErrorBoundary>
)}
</QueryErrorResetBoundary>
)