route
A reactive signal containing the current route information.
/** * The current route info as a reactive signal. * * { * handler: Function | null, * params: Record<string, string>, * query: Record<string, string>, * path: string * } */route()
Use it to reactively access the current path, params, query, and handler.
import { route, effect } from "@hellajs/router";
effect(() => { const r = route(); console.log("Current path:", r.path); console.log("Params:", r.params); console.log("Query:", r.query); // Use r.handler to render the current route's component});