MCPcopy Create free account
hub / github.com/TanStack/router / PostErrorComponent

Function PostErrorComponent

examples/react/basic-react-query/src/main.tsx:126–149  ·  view source on GitHub ↗
({ error }: ErrorComponentProps)

Source from the content-addressed store, hash-verified

124})
125
126function PostErrorComponent({ error }: ErrorComponentProps) {
127 const router = useRouter()
128 if (error instanceof NotFoundError) {
129 return <div>{error.message}</div>
130 }
131 const queryErrorResetBoundary = useQueryErrorResetBoundary()
132
133 React.useEffect(() => {
134 queryErrorResetBoundary.reset()
135 }, [queryErrorResetBoundary])
136
137 return (
138 <div>
139 <button
140 onClick={() => {
141 router.invalidate()
142 }}
143 >
144 retry
145 </button>
146 <ErrorComponent error={error} />
147 </div>
148 )
149}
150
151function PostRouteComponent() {
152 const { postId } = postRoute.useParams()

Callers

nothing calls this directly

Calls 2

useRouterFunction · 0.90
invalidateMethod · 0.45

Tested by

no test coverage detected