Navigation
Handle client-side transitions between routes using the Link component or programmatic hooks.
The <Link> Component
The <Link> component is the primary way to navigate in Dinou. It extends the standard HTML anchor element to provide client-side soft navigation (SPA transitions) and automatic performance optimizations.
"use client";
import { Link } from "dinou";
export default function NavBar() {
return (
<nav className="flex gap-4">
<Link href="/">Home</Link>
<Link href="/about">About</Link>
{/* Opt-in for fresh data */}
<Link href="/dashboard" fresh>
Live Dashboard
</Link>
</nav>
);
}Automatic Prefetching
By default, Dinou prefetches the code and data for the destination route when the user hovers over the link.
The "Fresh" Prop
Passing the fresh prop bypasses the Client Router Cache and forces a fetch of the latest data from the server. Ideal for volatile content.
Native Elements
Standard HTML
<a> tags also trigger client-side soft navigation via global event delegation in Dinou, but they lack the smart features (prefetching, fresh prop) provided by the <Link> component.