Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

§Classes

AbortedDeferredError

§Enums

NavigationType

Actions represent the type of change to a location value.

§Variables

defer
json

This is a shortcut for creating application/json responses. Converts data to JSON and sets the Content-Type header.

redirect

A redirect response. Sets the status code and the Location header. Defaults to "302 Found".

UNSAFE_DataRouterContext
UNSAFE_DataRouterStateContext
UNSAFE_LocationContext
UNSAFE_NavigationContext
UNSAFE_RouteContext

§Functions

Await

Component to use for rendering lazily loaded data from returning defer() in a loader function

createMemoryRouter
createPath

Creates a string URL path from the given pathname, search, and hash components.

createRoutesFromChildren

Creates a route config from a React "children" object, which is usually either a <Route> element or an array of them. Used internally by <Routes> to create a route config from its children.

createRoutesFromElements

Creates a route config from a React "children" object, which is usually either a <Route> element or an array of them. Used internally by <Routes> to create a route config from its children.

generatePath

Returns a path with params interpolated.

isRouteErrorResponse

Check if the given error is an ErrorResponse generated from a 4xx/5xx Response thrown from an action/loader

matchPath

Performs pattern matching on a URL pathname and returns information about the match.

matchRoutes

Matches the given routes to a location and returns the match data.

MemoryRouter

A that stores all entries in memory.

Navigate

Changes the current location.

Outlet

Renders the child route's element, if there is one.

parsePath

Parses a string URL path into its separate pathname, search, and hash components.

renderMatches

Renders the result of matchRoutes() into a React element.

resolvePath

Returns a resolved path object relative to the given pathname.

Route

Declares an element that should be rendered at a certain URL path.

Router

Provides location context for the rest of the app.

RouterProvider

Given a Remix Router instance, render the appropriate UI

Routes

A container for a nested tree of elements that renders the branch that best matches the current location.

UNSAFE_mapRouteProperties
UNSAFE_useRouteId

Returns the ID for the nearest contextual route

UNSAFE_useRoutesImpl
unstable_useBlocker

Allow the application to block navigations within the SPA and present the user a confirmation dialog to confirm the navigation. Mostly used to avoid using half-filled form data. This does not handle hard-reloads or cross-origin navigations.

useActionData

Returns the action data for the nearest ancestor Route action

useAsyncError

Returns the error from the nearest ancestor value

useAsyncValue

Returns the happy-path data from the nearest ancestor value

useHref

Returns the full href for the given "to" value. This is useful for building custom links that are also accessible and preserve right-click behavior.

useInRouterContext

Returns true if this component is a descendant of a .

useLoaderData

Returns the loader data for the nearest ancestor Route loader

useLocation

Returns the current location object, which represents the current URL in web browsers.

useMatch

Returns a PathMatch object if the given pattern matches the current URL. This is useful for components that need to know "active" state, e.g. .

useMatches

Returns the active route matches, useful for accessing loaderData for parent/child routes or the route "handle" property

useNavigate

Returns an imperative method for changing the location. Used by s, but may also be used by other elements to change the location.

useNavigation

Returns the current navigation, defaulting to an "idle" navigation when no navigation is in progress

useNavigationType

Returns the current navigation action which describes how the router came to the current location, either by a pop, push, or replace on the history stack.

useOutlet

Returns the element for the child route at this level of the route hierarchy. Used internally by to render child routes.

useOutletContext

Returns the context (if provided) for the child route at this level of the route hierarchy.

useParams

Returns an object of key/value pairs of the dynamic params from the current URL that were matched by the route path.

useResolvedPath

Resolves the pathname of the given to value against the current location.

useRevalidator

Returns a revalidate function for manually triggering revalidation, as well as the current state of any manual revalidations

useRouteError

Returns the nearest ancestor Route error, which could be a loader/action error or a render error. This is intended to be called from your ErrorBoundary/errorElement to display a proper error message.

useRouteLoaderData

Returns the loaderData for the given routeId

useRoutes

Returns the element of the route that matched the current location, prepared with the correct context to render the remainder of the route tree. Route elements in the tree must render an to render their child route's element.

§Interfaces

ActionFunction

Route action function signature

ActionFunctionArgs

Arguments passed to action functions

AwaitProps
DataRouteMatch
FutureConfig
IndexRouteObject
IndexRouteProps
LayoutRouteProps
LazyRouteFunction

lazy() function to load a route definition, which can add non-matching related properties to a route

LoaderFunction

Route loader function signature

LoaderFunctionArgs

Arguments passed to loader functions

Location

An entry in a history stack. A location contains information about the URL path, as well as possibly some arbitrary state and a key.

MemoryRouterProps
NavigateFunction

The interface for the navigate() function returned from useNavigate().

NavigateOptions
NavigateProps
Navigator

A Navigator is a "location changer"; it's how you get to different locations.

NonIndexRouteObject
OutletProps
Path

The pathname, search, and hash values of a URL.

PathMatch

A PathMatch contains info about how a PathPattern matched on a URL pathname.

PathPattern

A PathPattern is used to match on some portion of a URL pathname.

PathRouteProps
RouteMatch
RouterProps
RouterProviderProps
RoutesProps
ShouldRevalidateFunction

Route shouldRevalidate function signature. This runs after any submission (navigation or fetcher), so we flatten the navigation/fetcher submission onto the arguments. It shouldn't matter whether it came from a navigation or a fetcher, what really matters is the URLs and the formData since loaders have to re-run based on the data models that were potentially mutated.

§Type Aliases

DataRouteObject
Fetcher
Hash
JsonFunction
Navigation
ParamParseKey
Params

The parameters that were parsed from the URL path.

Pathname
RedirectFunction
RelativeRoutingType
RouteObject
RouteProps
Search
To

Describes a location that is the destination of some navigation, either via history.push or history.replace. May be either a URL or the pieces of a URL path.

unstable_Blocker
unstable_BlockerFunction