Skip to content

Link

Description

Component similar to A (from @solidjs/router) but with strong typing for paths and parameters.

Import

import { Link } from "dreamkit";

Definition

import type { JSXElement } from "solid-js";
declare function Link(props: {
href: string;
params?: Record<string, any>;
}): JSXElement;

Examples

Basic usage

import { $route, Link, s } from "dreamkit";
export const sectionRoute = $route
.path("/section")
.params({ name: s.string() })
.create(({ params }) => (
<>
<p>section: {params.name}</p>
<Link href="/">Go to home</Link>
</>
));
export default $route.path("/").create(() => (
<>
<Link href="/section" params={{ name: "one" }}>
Go to section one
</Link>
</>
));