Docs
API Reference
Components
Component

Component

The Component React component is the main component provided by Rasengan.js to setting up all the routing system based on the AppRouter that it receives as a prop.

This component is used inside the main.tsx file (the entry point of the application) to set up the routing system.

Usage

main.tsx
import { type AppProps } from "rasengan";
import AppRouter from "@app/app.router";
 
export default function App({ Component, children }: AppProps) {
  return <Component router={AppRouter}>{children}</Component>;
}

The Component component is injected by Rasengan.js into the App component, it's the only way to have access to that component.

The Component component receives the router prop, which is the AppRouter class that contains all the routes of the application. It will be responsible for setting up the routing system based on the routes defined in the AppRouter class.

Props

The Component component accepts two props:

  • router: The AppRouter class that contains all the routes of the application.
  • children: The children of the Component component, which represents all the routing system of the application.

Logo Image