The CatchBoundary component is a component that catches errors thrown by its children, renders an error component and optionally calls the onCatch callback. It also accepts a getResetKey function that can be used to declaratively reset the component's state when the key changes.
The CatchBoundary component accepts the following props:
import { CatchBoundary } from '@tanstack/react-router'
function Component() {
return (
<CatchBoundary
getResetKey={() => 'reset'}
onCatch={(error) => console.error(error)}
>
<div>My Component</div>
</CatchBoundary>
)
}
import { CatchBoundary } from '@tanstack/react-router'
function Component() {
return (
<CatchBoundary
getResetKey={() => 'reset'}
onCatch={(error) => console.error(error)}
>
<div>My Component</div>
</CatchBoundary>
)
}
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.