Package-level declarations
Types
Route action function signature
Arguments passed to action functions
Base RouteObject with common props shared by all types of routes
A data route object, which is just a RouteObject with a required unique ID
Index routes must not have children
Non-index routes may have children, but cannot have index
A RouteMatch contains info about how a route matched a URL.
A route object represents a logical route, with (optionally) its child routes organized in a tree-like structure.
A browser history stores the current location in regular URLs in a web browser environment. This is the standard for most web apps and provides the cleanest URLs the browser's address bar.
Loaders and actions can return anything except undefined
(null
is a valid return value if there is no data to return). Responses are preferred and will ease any future migration to Remix
Result from a loader or action - potentially successful or unsuccessful
Result from a loader or action called via dataStrategy
Successful defer() result from a loader or action
Function provided by the framework-aware layers to set hasErrorBoundary
from the framework-aware errorElement
prop
Unsuccessful result from a loader or action
Potential states for fetchers
Active navigation/fetcher form methods are exposed in lowercase on the RouterState
Future flags to toggle new feature behavior
Function signature for determining the current scroll position
Function signature for determining the key to be used in scroll restoration for a given location
A hash history stores the current location in the fragment identifier portion of the URL in a web browser environment.
Users can specify either lowercase or uppercase form methods on <Form>
, useSubmit(), <fetcher.Form>
, etc.
Data that can be passed into hydrate a Router from SSR
Keys we cannot change from within a lazy() function. We spread all other keys onto the route. Either they're meaningful to the router, or they'll get ignored.
A user-supplied object that describes a location. Used when providing entries to createMemoryHistory
via its initialEntries
option.
lazy() function to load a route definition, which can add non-matching related properties to a route
Options for a navigate() call for a normal (non-submission) navigation
Route loader function signature
Arguments passed to loader functions
Options for a fetch() load
Function provided by the framework-aware layers to set any framework-specific properties from framework-agnostic properties
A memory history stores locations in memory. This is useful in stateful environments where there is no web browser, such as node tests or React Native.
Potential states for state.navigation
The parameters that were parsed from the URL path.
A PathPattern is used to match on some portion of a URL pathname.
Redirect result from a loader or action
Options to pass to fetch()
Initialization options for createRouter
Options to pass to navigate() for a navigation
State maintained internally by the router. During a navigation, all states reflect the the "old" location unless otherwise noted.
Subscriber function signature for changes to router state
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.
Arguments passed to shouldRevalidate function
A StaticHandler instance manages a singular SSR navigation/fetch event
State returned from a server-side query() call
Future flags to toggle new feature behavior
Options for a navigate() call for a submission navigation
Options for a fetch() submission
Successful result from a loader or action
Properties
This is a shortcut for creating application/json
responses. Converts data
to JSON and sets the Content-Type
header.
A redirect response. Sets the status code and the Location
header. Defaults to "302 Found".
A redirect response that will force a document reload to the new location. Sets the status code and the Location
header. Defaults to "302 Found".
A redirect response that will perform a history.replaceState
instead of a history.pushState
for client-side navigation redirects. Sets the status code and the Location
header. Defaults to "302 Found".
Functions
Browser history stores the location in regular URLs. This is the standard for most web apps, but it requires some configuration on the server to ensure you serve the same app at multiple URLs.
Hash history stores the location in window.location.hash. This makes it ideal for situations where you don't want to send the location to the server for some reason, either because you do cannot configure it or the URL space is reserved for something else.
Creates a Location object with a unique key from the given Path
Memory history stores the current location in memory. It is designed for use in stateful non-browser environments like tests and React Native.
Creates a string URL path from the given pathname, search, and hash components.
Create a router and listen to history POP navigations
Create "responses" that contain status
/headers
without forcing serialization into an actual Response
- used by Remix single fetch
Returns a path with params interpolated.
Given an existing StaticHandlerContext and an error thrown at render time, provide an updated StaticHandlerContext suitable for a second SSR render
Check if the given error is an ErrorResponse generated from a 4xx/5xx Response thrown from an action/loader
Matches the given routes to a location and returns the match data.
Returns a resolved path object relative to the given pathname.