Vincent Niehues created this library for using Next.js style routes in a React Router 7 application.
import { type RouteConfig } from "@react-router/dev/routes";
import { generateRouteConfig, appRouterStyle } from "rr-next-routes";
const autoRoutes = generateRouteConfig({
...appRouterStyle,
print: "tree",
});
export default [
...autoRoutes,
route("some/path", "./some/file.tsx"),
] satisfies RouteConfig;
React Router’s routes.ts file allows for creating your own route generator functions and merging them with other routes, including React Router’s fs-routes or anything you want.
Leave a Reply