Skip to main content

Components

Creates a link to a given URL and forces it to be handled by the router.

Props

type LinkProps = {
to: string; // The route you're linking to (required)
replace?: boolean; // Replace instead of push (defaults to `false`)
activeClassName?: string;
activeStyle?: React.CSSProperties;
// …and any prop <a> takes
};

Usage

import { Link } from "@swan-io/chicane";

const App = () => (
<>
<Link to={Router.Home()}>Home</Link>
<Link to={Router.UseDetail({ userId: "123" })}>User</Link>
</>
);