npm install another-react-router
(bun/yarn/pnpm) add another-react-router
Create directory where all of your routes will be located
for example:
{
"src": {
"routes": [
"page.tsx"
]
},
}
Create a file with name page.tsx
and add the following code:
// ./src/routes/page.tsx
export default function Page() {
return <div>Hello another react router!</div>
}
Then run our cli to initialize router
npx arr init
Create RouterProvider component for your app
for example:
// ./src/components/providers/router-provider.tsx
import { AnotherReactRouterProvider } from "another-react-router"
import { routes } from "../../../another-react-router.config.ts"
export const RouterProvider = () => (
<AnotherReactRouterProvider routes={routes} />
)
Add RouterProvider to your app
// ./src/app.tsx
import { RouterProvider } from "@/components/providers/router-provider.tsx"
export const App = () => <RouterProvider />
Now your app is ready to go!
See more informations on https://another-react-router.vercel.com
See changelog in CHANGELOG.md