The CatchNotFound component is a component that catches not-found errors thrown by its children, renders a fallback component and optionally calls the onCatch callback. It resets when the pathname changes.
The CatchNotFound component accepts the following props:
import { CatchNotFound } from '@tanstack/react-router'
function Component() {
return (
<CatchNotFound
fallback={(error) => <p>Not found error! {JSON.stringify(error)}</p>}
>
<ComponentThatMightThrowANotFoundError />
</CatchNotFound>
)
}
import { CatchNotFound } from '@tanstack/react-router'
function Component() {
return (
<CatchNotFound
fallback={(error) => <p>Not found error! {JSON.stringify(error)}</p>}
>
<ComponentThatMightThrowANotFoundError />
</CatchNotFound>
)
}
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.