TanStack Router automatically shares and infers state between nested routes in a type-safe manner. Path params, search params, and router context defined in parent routes are automatically available to all child routes with full TypeScript inference. When a parent route parses a path param (e.g., converting a string to number), child routes automatically receive the correct type. Search params merge across the route hierarchy, and router context can be modified at each route level with changes propagating to descendants. This inheritance pattern enables powerful patterns like dependency injection and accumulated state management throughout the route tree.

5m read timeFrom tkdodo.eu
Post cover image
Table of contents
Path ParamsSearch ParamsRouter Context

Sort: