@cookbook/router-react
The complete React adapter: providers, typed links, route rendering, outlets, slots, lazy views, public contexts, and every hook.
@cookbook/router-react is the React 18+ adapter for the renderer-neutral core. It does not own matching, URL parsing, middleware, route validation, or navigation. It subscribes to a core Router, converts resolved matches to React output, and exposes typed components and hooks.
Import surface
import {
Link,
NavLink,
Outlet,
RouterProvider,
Slot,
lazyRouteView,
useNavigate,
useParams,
} from '@cookbook/router-react';The package publishes one root entrypoint. Internal source paths are not public API.
Reference map
| Area | What is covered |
|---|---|
| Providers and render helpers | RouterProvider, StaticRouterProvider, useRouterState, renderReactRouteMatch, and renderRouteBoundary |
| Links | Link, NavLink, active matching, prefetch, and native-browser preservation |
| Outlets, slots, and lazy views | Outlet, Slot, slot-local error isolation, and lazyRouteView |
| Hooks | Router state, navigation, URL state, blockers, outlet context, and route metadata |
| Contracts | Every exported React interface, type alias, and context value |
Responsibility boundary
React receives already-resolved router state. Hooks such as useSearchParams() and useHashParams() do not reparse the browser URL and do not accept URL policy overrides. Configure those policies on routes, router creation, explicit router.match() calls, links, or navigation calls.
Where this bites
A React component can render perfectly while the route contract is wrong. Treat core validation and generated contracts as the authority; the React package is an adapter, not a second router.
Core contracts
Generated registration, route URL input/output types, normalized routes, middleware, lifecycle, slots, intercepts, and metadata.
Providers and render helpers
Deep reference for RouterProvider, StaticRouterProvider, external-store subscription, React route traversal, route contexts, and route boundaries.