UNPKG

@tanstack/solid-router

Version:

Modern and scalable routing for Solid applications

30 lines 1 kB
import { isNotFound } from '@tanstack/router-core'; import { CatchBoundary } from './CatchBoundary'; import { useRouterState } from './useRouterState'; export function CatchNotFound(props) { // TODO: Some way for the user to programmatically reset the not-found boundary? const resetKey = useRouterState({ select: (s) => `not-found-${s.location.pathname}-${s.status}`, }); return (<CatchBoundary getResetKey={() => resetKey()} onCatch={(error) => { if (isNotFound(error)) { props.onCatch?.(error); } else { throw error; } }} errorComponent={({ error }) => { if (isNotFound(error)) { return props.fallback?.(error); } else { throw error; } }}> {props.children} </CatchBoundary>); } export function DefaultGlobalNotFound() { return <p>Not Found</p>; } //# sourceMappingURL=not-found.jsx.map