| isRouteErrorResponse | R Documentation |
https://api.reactrouter.com/v7/functions/react-router.isRouteErrorResponse.html
isRouteErrorResponse()
Returns a JS reference to the isRouteErrorResponse
type guard. Use it inside an errorElement render callback to branch
on whether the error came from a thrown Response
(e.g. throw new Response(..., { status: 404 })) or from arbitrary
code. Pair with useRouteError.
Calling isRouteErrorResponse() from R returns a JS
expression that evaluates, in the browser, to the upstream
isRouteErrorResponse function. Interpolate it inside the
render string of useRouteError() as shown below.
For convenience, the same function is also reachable inside any
user-authored JS string as
window.jsmodule['@/reactRouter'].helpers.isRouteErrorResponse.
A JS expression evaluating to the
isRouteErrorResponse function reference.
## Not run:
useRouteError(render = JS(paste0(
"e => ", isRouteErrorResponse(),
"(e) ? <p>HTTP {e.status}</p> : <p>Unknown error</p>"
)))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.