API Reference

Complete API documentation for @funstack/router. Select a category above or browse below.

Components

Core components for building routing in your React application.

  • <Router> — The main router component that provides routing context
  • <Outlet> — Renders child route components for nested layouts

Hooks

React hooks for accessing router state and navigation.

  • useLocation() — Current location object
  • useSearchParams() — Search query management
  • useBlocker() — Prevent navigation away from current route
  • useRouteParams() — Type-safe route parameters
  • useRouteState() — Type-safe navigation state
  • useRouteData() — Type-safe loader data
  • useIsPending() — Navigation transition pending state

Utilities

Helper functions for defining routes and managing state.

  • route() — Route definition helper with type inference
  • routeState() — Typed navigation state management
  • hardReload() — Full page reload bypassing the router
  • hardNavigate() — Full page navigation bypassing the router

Types

TypeScript types and interfaces exported by the router.

  • RouteComponentProps — Props type for route components
  • RouteComponentPropsWithData — Props type with loader data
  • PathParams — Extract parameters from path patterns
  • TypefulOpaqueRouteDefinition — Type-safe route definition
  • ExtractRouteId, ExtractRouteParams, ExtractRouteState, ExtractRouteData — Type extraction utilities
  • RouteDefinition, ActionArgs, LoaderArgs, Location, NavigateOptions