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
Form

A @remix-run/router-aware <form>. It behaves like a normal form except that the interaction with the server is with fetch instead of new document requests, allowing components to add nicer UX to the page as the form is submitted and returns with data.

json

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

Link

The public API for rendering a history-aware .

NavLink

A wrapper that knows if it's "active" or not.

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

BrowserRouter

A <Router> for use in web browsers. Provides the cleanest URLs.

createBrowserRouter
createHashRouter
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.

createSearchParams

Creates a URLSearchParams object using the given initializer.

generatePath

Returns a path with params interpolated.

HashRouter

A <Router> for use in web browsers. Stores the location in the hash portion of the URL so it is not sent to the server.

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.

ScrollRestoration

This component will emulate the browser's scroll restoration on location changes.

UNSAFE_useRouteId

Returns the ID for the nearest contextual route

UNSAFE_useScrollRestoration

When rendered inside a RouterProvider, will restore scroll positions on navigations

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.

unstable_usePrompt

Wrapper around useBlocker to show a window.confirm prompt to users instead of building a custom UI with useBlocker.

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

useBeforeUnload

Setup a callback to be fired on the window's beforeunload event. This is useful for saving some data to window.localStorage just before the page refreshes.

useFetcher

Interacts with route loaders and actions without causing a navigation. Great for any interaction that stays on the same page.

useFetchers

Provides all fetchers currently on the page. Useful for layouts and parent routes that need to provide pending/optimistic UI regarding the fetch.

useFormAction
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 .

useLinkClickHandler

Handles the click behavior for router <Link> components. This is useful if you need to create custom <Link> components with the same click behavior we use in our exported <Link>.

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.

useSearchParams

A convenient wrapper for reading and writing search parameters via the URLSearchParams interface.

useSubmit

Returns a function that may be used to programmatically submit a form (or some arbitrary data) to the server.

§Interfaces

ActionFunction

Route action function signature

ActionFunctionArgs

Arguments passed to action functions

AwaitProps
BrowserRouterProps
DataRouteMatch
FetcherSubmitFunction

Submits a fetcher <form> to the server without reloading the page.

FormProps
GetScrollRestorationKeyFunction

Function signature for determining the key to be used in scroll restoration for a given location

HashRouterProps
HistoryRouterProps
IndexRouteObject
IndexRouteProps
LayoutRouteProps
LazyRouteFunction

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

LinkProps
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.

NavLinkProps
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
ScrollRestorationProps
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.

SubmitFunction

Submits a HTML <form> to the server without reloading the page.

SubmitOptions

§Type Aliases

DataRouteObject
Fetcher
FetcherWithComponents
FormEncType
FormMethod

Active navigation/fetcher form methods are exposed in lowercase on the RouterState

Hash
JsonFunction
Navigation
ParamKeyValuePair
ParamParseKey
Params

The parameters that were parsed from the URL path.

Pathname
RedirectFunction
RelativeRoutingType
RouteObject
RouteProps
Search
SetURLSearchParams
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
URLSearchParamsInit
V7_FormMethod

In v7, active navigation/fetcher form methods are exposed in uppercase on the RouterState. This is to align with the normalization done via fetch().