본문으로 건너뛰기

useQueryErrorResetBoundary

function useQueryErrorResetBoundary(): QueryErrorResetBoundaryValue;

정의 위치: preact-query/src/QueryErrorResetBoundary.tsx:85

이 훅은 가장 가까운 QueryErrorResetBoundary 내의 모든 쿼리 오류를 재설정합니다. boundary가 없으면 정의하면 전역에서 재설정됩니다.

반환값

QueryErrorResetBoundaryValue

경계의 QueryErrorResetBoundaryValue.

예시

import { useErrorBoundary } from 'preact/hooks'
import type { ComponentChildren } from 'preact'
import { useQueryErrorResetBoundary } from '@tanstack/preact-query'

function App({ children }: { children: ComponentChildren }) {
const { reset } = useQueryErrorResetBoundary()
const [error, resetError] = useErrorBoundary(() => reset())

if (error) {
return (
<div>
There was an error!
<button onClick={() => resetError()}>Try again</button>
</div>
)
}

return children
}