API REFERENCE
Define Routes Group
defineRoutesGroup() is an utility function that allows you to create a routes group by attaching pages under a same path.
Imagine you have multiple pages that share the same path, you can use this function to group them together.
tsximport { defineRoutesGroup } from "rasengan"; import Dashboard from "@/app/admin/dashboard.page"; import Users from "@/app/admin/users.page"; import Settings from "@/app/admin/settings.page"; import Profile from "@/app/admin/profile.page"; export default defineRoutesGroup({ path: "/admin", children: [ Dashboard, Users, Settings, Profile, ] });
As you can see, all the pages are grouped under the same path. This group can be easily imported in your router.
tsximport { RouterComponent, defineRouter } from "rasengan"; import AdminGroup from "@/app/admin.group"; class AppRouter extends RouterComponent {} export default defineRouter({ pages: [AdminGroup], })(AppRouter);
defineRoutesGroup() accepts an object with the following properties:
| Option | Type | Description | Optional |
|---|---|---|---|
path | string | The path of the routes group | No |
children | PageComponent[] | MDXPageComponent[] | The pages to be grouped under the same path | No |
defineRoutesGroup
renderApp