Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
sealed external interface Action

Actions represent the type of change to a location value.

Link copied to clipboard
sealed external interface ActionFunction<Context> : ActionLike

Route action function signature

Link copied to clipboard
sealed external interface ActionFunctionArgs<Context> : DataFunctionArgs<Context>

Arguments passed to action functions

Link copied to clipboard
sealed external interface ActionLike
Link copied to clipboard
sealed external interface AgnosticBaseRouteObject

Base RouteObject with common props shared by all types of routes

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A data route object, which is just a RouteObject with a required unique ID

Link copied to clipboard

Index routes must not have children

Link copied to clipboard

Non-index routes may have children, but cannot have index

Link copied to clipboard

A RouteMatch contains info about how a route matched a URL.

Link copied to clipboard

A route object represents a logical route, with (optionally) its child routes organized in a tree-like structure.

Link copied to clipboard
Link copied to clipboard
sealed external interface BaseNavigateOrFetchOptions
Link copied to clipboard
sealed external interface BaseSubmissionOptions
Link copied to clipboard
typealias Blocker = Any
Link copied to clipboard
sealed external interface BlockerBlocked
Link copied to clipboard
Link copied to clipboard
sealed external interface BlockerFunctionArgs
Link copied to clipboard
sealed external interface BlockerProceeding
Link copied to clipboard
sealed external interface BlockerUnblocked
Link copied to clipboard
sealed external interface BrowserHistory : UrlHistory

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.

Link copied to clipboard
Link copied to clipboard
sealed external interface CreateStaticHandlerOptions
Link copied to clipboard
sealed external interface DataFunctionArgs<Context>
Link copied to clipboard
typealias DataFunctionValue = Any?

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

Link copied to clipboard
typealias DataResult = Any

Result from a loader or action - potentially successful or unsuccessful

Link copied to clipboard
sealed external interface DataStrategyFunction
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
sealed external interface DataStrategyResult

Result from a loader or action called via dataStrategy

Link copied to clipboard
sealed external interface DataStrategyResultType
Link copied to clipboard
external class DataWithResponseInit<D>
Link copied to clipboard
typealias DeferFunction = (data: ReadonlyRecord<String, Any?>, init: Any?) -> DeferredData
Link copied to clipboard
external class DeferredData
Link copied to clipboard
sealed external interface DeferredResult

Successful defer() result from a loader or action

Link copied to clipboard

Function provided by the framework-aware layers to set hasErrorBoundary from the framework-aware errorElement prop

Link copied to clipboard
sealed external interface ErrorResponse
Link copied to clipboard
Link copied to clipboard
sealed external interface ErrorResult

Unsuccessful result from a loader or action

Link copied to clipboard
external interface Fetcher<TData>
Link copied to clipboard
sealed external interface FetcherStates<TData>

Potential states for fetchers

Link copied to clipboard
sealed external interface FetcherStatesIdle<TData>
Link copied to clipboard
sealed external interface FetcherStatesLoading<TData>
Link copied to clipboard
sealed external interface FetcherStatesSubmitting<TData>
Link copied to clipboard
sealed external interface FormEncType
Link copied to clipboard
sealed external interface FormMethod

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

Link copied to clipboard
sealed external interface FutureConfig

Future flags to toggle new feature behavior

Link copied to clipboard

Function signature for determining the current scroll position

Link copied to clipboard
typealias GetScrollRestorationKeyFunction = (location: Location<*>, matches: ReadonlyArray<UIMatch<*, *>>) -> String?

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

Link copied to clipboard
sealed external interface HashHistory : UrlHistory

A hash history stores the current location in the fragment identifier portion of the URL in a web browser environment.

Link copied to clipboard
Link copied to clipboard
sealed external interface History

A history is an interface to the navigation stack. The history serves as the source of truth for the current location, as well as provides a set of methods that may be used to change it.

Link copied to clipboard

Users can specify either lowercase or uppercase form methods on <Form>, useSubmit(), <fetcher.Form>, etc.

Link copied to clipboard

Data that can be passed into hydrate a Router from SSR

Link copied to clipboard
sealed external interface ImmutableRouteKey

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.

Link copied to clipboard
typealias InitialEntry = Any

A user-supplied object that describes a location. Used when providing entries to createMemoryHistory via its initialEntries option.

Link copied to clipboard
typealias JsonFunction<Data> = (data: Data, init: Any?) -> Response
Link copied to clipboard
typealias JsonValue = Any?
Link copied to clipboard
typealias LazyRouteFunction<R> = () -> Promise<R>

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

Link copied to clipboard

Options for a navigate() call for a normal (non-submission) navigation

Link copied to clipboard
typealias Listener = (update: Update) -> Unit

A function that receives notifications about location changes.

Link copied to clipboard
sealed external interface LoaderFunction<Context> : LoaderLike

Route loader function signature

Link copied to clipboard
sealed external interface LoaderFunctionArgs<Context> : DataFunctionArgs<Context>

Arguments passed to loader functions

Link copied to clipboard
sealed external interface LoaderLike
Link copied to clipboard

Options for a fetch() load

Link copied to clipboard
sealed external interface Location<State> : Path

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

Link copied to clipboard
sealed external interface MapRoutePropertiesFunction

Function provided by the framework-aware layers to set any framework-specific properties from framework-agnostic properties

Link copied to clipboard
Link copied to clipboard
sealed external interface MemoryHistory : History

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.

Link copied to clipboard
sealed external interface MemoryHistoryOptions
Link copied to clipboard
Link copied to clipboard
sealed external interface Navigation
Link copied to clipboard
sealed external interface NavigationStates

Potential states for state.navigation

Link copied to clipboard
sealed external interface NavigationStatesIdle
Link copied to clipboard
sealed external interface NavigationStatesLoading
Link copied to clipboard
sealed external interface NavigationStatesSubmitting
Link copied to clipboard

The parameters that were parsed from the URL path.

Link copied to clipboard
sealed external interface Path

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

Link copied to clipboard
sealed external interface PathMatch

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

Link copied to clipboard
sealed external interface PathPattern

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

Link copied to clipboard
typealias RedirectFunction = (url: String, init: Any?) -> Response
Link copied to clipboard
sealed external interface RedirectResult

Redirect result from a loader or action

Link copied to clipboard
sealed external interface RelativeRoutingType
Link copied to clipboard
sealed external interface ResultType
Link copied to clipboard
sealed external interface RevalidationState
Link copied to clipboard
sealed external interface RouteData

Map of routeId -> data returned from a loader/action/error

Link copied to clipboard
sealed external interface Router

A Router instance manages all navigation and data loading/mutations

Link copied to clipboard

Options to pass to fetch()

Link copied to clipboard
sealed external interface RouterInit

Initialization options for createRouter

Link copied to clipboard

Options to pass to navigate() for a navigation

Link copied to clipboard
sealed external interface RouterState

State maintained internally by the router. During a navigation, all states reflect the the "old" location unless otherwise noted.

Link copied to clipboard
typealias RouterSubscriber = (state: RouterState, opts: RouterSubscriberOpts) -> Unit

Subscriber function signature for changes to router state

Link copied to clipboard
sealed external interface RouterSubscriberOpts
Link copied to clipboard

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.

Link copied to clipboard
sealed external interface ShouldRevalidateFunctionArgs

Arguments passed to shouldRevalidate function

Link copied to clipboard
sealed external interface StaticHandler

A StaticHandler instance manages a singular SSR navigation/fetch event

Link copied to clipboard
sealed external interface StaticHandlerContext

State returned from a server-side query() call

Link copied to clipboard
sealed external interface StaticHandlerFutureConfig

Future flags to toggle new feature behavior

Link copied to clipboard
sealed external interface StaticHandlerQueryOpts
Link copied to clipboard
sealed external interface StaticHandlerQueryRouteOpts
Link copied to clipboard
typealias Submission = Any
Link copied to clipboard

Options for a navigate() call for a submission navigation

Link copied to clipboard

Options for a fetch() submission

Link copied to clipboard
sealed external interface SuccessResult

Successful result from a loader or action

Link copied to clipboard
typealias To = Any

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

Link copied to clipboard
typealias TrackedPromise = Promise<Any?>
Link copied to clipboard
sealed external interface UIMatch<Data, Handle>
Link copied to clipboard
sealed external interface Update

A change to the current location.

Link copied to clipboard
sealed external interface UrlHistory : History
Link copied to clipboard
sealed external interface UrlHistoryOptions
Link copied to clipboard
sealed external interface ViewTransitionOpts

Properties

Link copied to clipboard
external val defer: DeferFunction
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
external val joinPaths: (ReadonlyArray<String>) -> String
Link copied to clipboard
external val json: JsonFunction<*>

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

Link copied to clipboard
external val normalizeHash: (hash: String) -> String
Link copied to clipboard
external val normalizePathname: (pathname: String) -> String
Link copied to clipboard
external val normalizeSearch: (search: String) -> String
Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

Functions

Link copied to clipboard
inline fun <Context> ActionFunction(noinline value: (args: ActionFunctionArgs<Context>, handlerCtx: Any?) -> DataFunctionReturnValue): ActionFunction<Context>
Link copied to clipboard
inline fun ActionLike(value: Boolean): ActionLike
Link copied to clipboard
external fun convertRouteMatchToUiMatch(match: AgnosticDataRouteMatch, loaderData: RouteData): UIMatch<*, *>
Link copied to clipboard
external fun convertRoutesToDataRoutes(routes: ReadonlyArray<AgnosticRouteObject>, mapRouteProperties: MapRoutePropertiesFunction, parentPath: ReadonlyArray<String> = definedExternally, manifest: RouteManifest = definedExternally): ReadonlyArray<AgnosticDataRouteObject>
Link copied to clipboard
external fun createBrowserHistory(options: BrowserHistoryOptions = definedExternally): BrowserHistory

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.

Link copied to clipboard
external fun createHashHistory(options: HashHistoryOptions = definedExternally): HashHistory

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.

Link copied to clipboard
external fun createLocation(current: String, to: To, state: Any? = definedExternally, key: String = definedExternally): Location<*>
external fun createLocation(current: Location<*>, to: To, state: Any? = definedExternally, key: String = definedExternally): Location<*>

Creates a Location object with a unique key from the given Path

Link copied to clipboard
external fun createMemoryHistory(options: MemoryHistoryOptions = definedExternally): MemoryHistory

Memory history stores the current location in memory. It is designed for use in stateful non-browser environments like tests and React Native.

Link copied to clipboard
external fun createPath(options: Path): String

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

Link copied to clipboard
external fun createRouter(init: RouterInit): Router

Create a router and listen to history POP navigations

Link copied to clipboard
Link copied to clipboard
external fun <D> data(data: D): DataWithResponseInit<D>
external fun <D> data(data: D, init: Double = definedExternally): DataWithResponseInit<D>
external fun <D> data(data: D, init: ResponseInit = definedExternally): DataWithResponseInit<D>

Create "responses" that contain status/headers without forcing serialization into an actual Response - used by Remix single fetch

Link copied to clipboard
external fun decodePath(value: String): String
Link copied to clipboard
external fun generatePath(originalPath: String, params: ReadonlyRecord<String, String> = definedExternally): String

Returns a path with params interpolated.

Link copied to clipboard
Link copied to clipboard
external fun <T : AgnosticRouteMatch<*>> getResolveToMatches(matches: ReadonlyArray<T>, v7_relativeSplatPath: Boolean): ReadonlyArray<String>
Link copied to clipboard

Given an existing StaticHandlerContext and an error thrown at render time, provide an updated StaticHandlerContext suitable for a second SSR render

Link copied to clipboard
external fun getToPathname(to: To): String?
Link copied to clipboard
external fun <T> invariant(value: T?, message: String = definedExternally)
external fun invariant(value: Boolean, message: String = definedExternally)
Link copied to clipboard
external fun isDataWithResponseInit(value: Any?): Boolean
Link copied to clipboard
external fun isDeferredData(value: Any?): Boolean
Link copied to clipboard
external fun isRouteErrorResponse(error: Any?): Boolean

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

Link copied to clipboard
inline fun <Context> LoaderFunction(noinline value: (args: LoaderFunctionArgs<Context>, handlerCtx: Any?) -> DataFunctionReturnValue): LoaderFunction<Context>
Link copied to clipboard
inline fun LoaderLike(value: Boolean): LoaderLike
Link copied to clipboard
external fun matchPath(pattern: String, pathname: String): PathMatch?
external fun matchPath(pattern: PathPattern, pathname: String): PathMatch?

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

Link copied to clipboard

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

Link copied to clipboard
external fun parsePath(path: String): Path

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

Link copied to clipboard
external fun resolvePath(to: To, fromPathname: String = definedExternally): Path

Returns a resolved path object relative to the given pathname.

Link copied to clipboard
external fun resolveTo(toArg: To, routePathnames: ReadonlyArray<String>, locationPathname: String, isPathRelative: Boolean = definedExternally): Path
Link copied to clipboard
external fun stripBasename(pathname: String, basename: String): String?
Link copied to clipboard
external fun warning(cond: Any?, message: String)