another-react-router
v1.3.1
Published
Fast. File-based. Router.
Downloads
52
Readme
Another react router
Another react router is a npm package, that allowes developers and users comfortable route between pages on their web applications built with react
library.
Installation
npm install another-react-router
(bun/yarn/pnpm) add another-react-router
Getting started
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!
Documentation
See more informations on https://another-react-router.vercel.app/