Modern and scalable routing for React applications.
ReactLynx supports both Memory Routing
and File-Based Routing,
where Memory Routing is required due to browser History API limitations in Lynx,
and File-Based Routing is enabled through seamless @tanstack/router-plugin/rspack
integration in Rspeedy.
Install dependencies:
Install devDependencies:
@tanstack/router-plugin/rspack
for seamless routing integration.@lynx-js/react/compat
to ensure third-party libraries work correctly.ReactLynx offers React 18 API compatibility via @lynx-js/react/compat
,
providing crucial APIs such as React.startTransition
required by TanStack
Router.
To ensure URLSearchParams API works correctly in the Lynx environment,
add url-search-params-polyfill
at the top of your entry file:
TanStack Router supports file-based routing where your file structure defines your routes.
Place your route components in the src/routes
directory, with __root.tsx
serving as the root component.
The @tanstack/router-plugin/rspack
automatically scans the src/routes
directory and generates a routeTree.gen.ts
file
that contains all the route definitions and type information. This generated file includes:
See TanStack File-Based Routing for more details.