routePath
import { routePath } from "dreamkit";Utility function to construct a routing path along with its parameters.
Definition
const routePath: (path: string, params?: Record<string, any>) => string;Examples
Basic usage
import { $route, routePath, s } from "dreamkit";
export const userRoute = $route .params({ id: s.number() }) .path(({ id }) => `/user/${id}`) .create(({ params }) => <>id: {params.id}</>);
export default $route.path("/").create(() => { return <a href={routePath("/user/:id", { id: 1 })}>User 1</a>;});