Package-level declarations

Types

Link copied to clipboard
sealed external interface AwaitProps : Props
Link copied to clipboard
typealias AwaitResolveRenderFunction = (data: Any?) -> ReactNode
Link copied to clipboard
sealed external interface CreateMemoryRouterOpts
Link copied to clipboard
sealed external interface DataRouteMatch : RouteMatch<DataRouteObject>
Link copied to clipboard
sealed external interface DataRouteObject : RouteObject
Link copied to clipboard
Link copied to clipboard
sealed external interface FutureConfig
Link copied to clipboard
typealias Hash = String
Link copied to clipboard
sealed external interface LocationContextObject
Link copied to clipboard
sealed external interface MapRoutePropertiesResult : RouteObject
Link copied to clipboard
sealed external interface NavigateFunction

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

Link copied to clipboard
sealed external interface NavigateOptions
Link copied to clipboard
sealed external interface NavigateProps : Props
Link copied to clipboard
sealed external interface NavigationContextObject
Link copied to clipboard
sealed external interface NavigationContextObjectFuture
Link copied to clipboard
sealed external interface Navigator

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

Link copied to clipboard
sealed external interface OutletProps : Props
Link copied to clipboard
typealias Pathname = String
Link copied to clipboard
sealed external interface RenderErrorBoundaryProps : PropsWithChildren
Link copied to clipboard
sealed external interface RenderErrorBoundaryState
Link copied to clipboard
sealed external interface RouteContextObject
Link copied to clipboard
Link copied to clipboard
sealed external interface RouteObject
Link copied to clipboard
sealed external interface RouterProviderProps : Props
Link copied to clipboard
typealias Search = String
Link copied to clipboard
sealed external interface UseHrefOptions
Link copied to clipboard
sealed external interface UseResolvedPathOptions
Link copied to clipboard
sealed external interface UseRevalidatorResult

Properties

Link copied to clipboard
external val Await: FC<AwaitProps>

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

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
external val Navigate: FC<NavigateProps>

Changes the current location.

Link copied to clipboard
Link copied to clipboard
external val Outlet: FC<OutletProps>

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

Link copied to clipboard
Link copied to clipboard
external val RouteErrorContext: Context<Any?>
Link copied to clipboard

Given a Remix Router instance, render the appropriate UI

Functions

Link copied to clipboard
external fun _renderMatches(matches: ReadonlyArray<RouteMatch<*>>?, parentMatches: ReadonlyArray<RouteMatch<*>> = definedExternally, dataRouterState: RouterState? = definedExternally, future: FutureConfig? = definedExternally): ReactElement<*>?
Link copied to clipboard
external fun createMemoryRouter(routes: ReadonlyArray<RouteObject>, opts: CreateMemoryRouterOpts = definedExternally): Router
Link copied to clipboard
Link copied to clipboard
external fun renderMatches(matches: ReadonlyArray<RouteMatch<*>>?): ReactElement<*>?

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

Link copied to clipboard
external fun useActionData(): Any?

Returns the action data for the nearest ancestor Route action

Link copied to clipboard
external fun useAsyncError(): JsError?

Returns the error from the nearest ancestor <Await /> value

Link copied to clipboard
external fun useAsyncValue(): Any?

Returns the happy-path data from the nearest ancestor <Await /> value

Link copied to clipboard
external fun useBlocker(shouldBlock: Boolean): Blocker
external fun useBlocker(shouldBlock: BlockerFunction): Blocker

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.

Link copied to clipboard
external fun useHref(to: To, options: UseHrefOptions = definedExternally): String

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.

Link copied to clipboard
external fun useInRouterContext(): Boolean

Returns true if this component is a descendant of a <Router>.

Link copied to clipboard
external fun useLoaderData(): Any?

Returns the loader data for the nearest ancestor Route loader

Link copied to clipboard
external fun useLocation(): Location<*>

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

Link copied to clipboard
external fun useMatch(pattern: String): PathMatch?
external fun useMatch(pattern: PathPattern): PathMatch?

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

Link copied to clipboard
external fun useMatches(): ReadonlyArray<UIMatch<*, *>>

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

Link copied to clipboard

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

Link copied to clipboard
external fun useNavigation(): Navigation

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

Link copied to clipboard
external fun useNavigationType(): Action

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.

Link copied to clipboard
external fun useOutlet(context: Any? = definedExternally): ReactElement<*>?

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

Link copied to clipboard
external fun <Context> useOutletContext(): Context

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

Link copied to clipboard
external fun useParams(): Params

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

Link copied to clipboard
external fun useResolvedPath(to: To, options: UseResolvedPathOptions = definedExternally): Path

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

Link copied to clipboard

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

Link copied to clipboard
external fun useRouteError(): Any?

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.

Link copied to clipboard
external fun useRouteId(): String

Returns the ID for the nearest contextual route

Link copied to clipboard
external fun useRouteLoaderData(routeId: String): Any?

Returns the loaderData for the given routeId

Link copied to clipboard
external fun useRoutes(routes: ReadonlyArray<RouteObject>): ReactElement<*>?
external fun useRoutes(routes: ReadonlyArray<RouteObject>, locationArg: String = definedExternally): ReactElement<*>?
external fun useRoutes(routes: ReadonlyArray<RouteObject>, locationArg: Location<*> = definedExternally): ReactElement<*>?

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 <Outlet> to render their child route's element.

Link copied to clipboard
external fun useRoutesImpl(routes: ReadonlyArray<RouteObject>, locationArg: String = definedExternally, dataRouterState: RouterState = definedExternally, future: FutureConfig = definedExternally): ReactElement<*>?
external fun useRoutesImpl(routes: ReadonlyArray<RouteObject>, locationArg: Location<*> = definedExternally, dataRouterState: RouterState = definedExternally, future: FutureConfig = definedExternally): ReactElement<*>?