nano-kit-react-router

Installation
SKILL.md

@nano_kit/react-router

@nano_kit/router is a small signal-based router: the current location is a signal, routes are a typed table, pages and layouts are matched into a page signal, and links, head tags and scroll are utilities on top. @nano_kit/react-router re-exports it and adds the React pieces. Signals, stores and DI are described in the nano-kit-store skill, component bindings in nano-kit-react.

Reference

DOCS.md next to this file is the documentation of the released packages as published on https://nano-kit.js.org, generated from the site sources. Read it for the route syntax, tokens, hooks, components and descriptors before writing code. This skill adds only conventions, choices and pitfalls.

Setup contract

  • Declare the route table once, as const, and augment AppContext.routes exactly once, so Location$, Navigation$, Paths$ and Link are typed by it.
  • Provide LocationNavigation$ (from browserNavigation(routes)), Page$ (from router($location, pages)) and Pages$ together at the root; the derived tokens come for free.
  • Render with the ready-made App, let layouts render children through Outlet, and call useSyncHead(), useLinkComponentPreload() and useLinkComponentAriaCurrent() once in the root layout.
  • Page modules export the component as default and, when needed, Stores$ (what SSR awaits and dehydrates), Head$ (head descriptors) and statusCode.

URL-derived state

Installs
2
GitHub Stars
44
First Seen
Oct 27, 2026