Bini.js provides built-in navigation components and hooks for fast, client-side transitions between routes without full page reloads. This page covers how to use Link, NavLink, and the navigation hooks.
The <Link> component is the primary way to navigate between routes. It extends the HTML <a> tag to provide client-side navigation, and it is auto-imported in all pages and layouts.
Bini.js prefetches the destination route on hover and focus, so navigation feels instant. Add data-no-prefetch to a specific link to opt out.
| Prop | Type | Description |
|---|---|---|
| to | string | The destination route path |
| replace | boolean | Replace the current entry in history instead of adding |
| state | any | State to persist to the location |
| className | string | CSS class for styling |
| children | ReactNode | The content inside the link |
The useParams hook returns an object of key/value pairs of the dynamic route parameters from the current URL. Wrap a folder name in square brackets, like [slug], to create a dynamic segment.
[...slug], the value is exposed under params['*'], not the name written in the folder.The useLocation hook returns the current location object, including pathname, search, hash, and any state passed during navigation. This is useful for things like breadcrumbs.
| Property | Type | Description |
|---|---|---|
| pathname | string | The path of the current URL |
| search | string | The query string, including the leading ? |
| hash | string | The URL hash, including the leading # |
| state | any | State passed via Link or navigate |
| key | string | A unique key for this location entry |
The useSearchParams hook reads and updates the query string. It works like useState: you get the current params and a function to change them.
<Link> for standard navigation links.<NavLink> for navigation menus that need active-state styling.useNavigate for programmatic navigation, such as redirects after a form or login.useParams to access dynamic route parameters.useSearchParams for managing query strings and filters.Create your first pages and wrap them in shared layouts.
Define routes from the filesystem with folder-based and file-based conventions.
Match URL segments with dynamic parameters and catch-alls.
Add backend endpoints with plain functions or a full Hono app.
Control titles, descriptions, and social previews per route.
Deploy to Node, Vercel, Netlify, Cloudflare, or Deno, or build native apps in CI.
Bini.js provides built-in navigation components and hooks for fast, client-side transitions between routes without full page reloads. This page covers how to use Link, NavLink, and the navigation hooks.
The <Link> component is the primary way to navigate between routes. It extends the HTML <a> tag to provide client-side navigation, and it is auto-imported in all pages and layouts.
Bini.js prefetches the destination route on hover and focus, so navigation feels instant. Add data-no-prefetch to a specific link to opt out.
| Prop | Type | Description |
|---|---|---|
| to | string | The destination route path |
| replace | boolean | Replace the current entry in history instead of adding |
| state | any | State to persist to the location |
| className | string | CSS class for styling |
| children | ReactNode | The content inside the link |
The useParams hook returns an object of key/value pairs of the dynamic route parameters from the current URL. Wrap a folder name in square brackets, like [slug], to create a dynamic segment.
[...slug], the value is exposed under params['*'], not the name written in the folder.The useLocation hook returns the current location object, including pathname, search, hash, and any state passed during navigation. This is useful for things like breadcrumbs.
| Property | Type | Description |
|---|---|---|
| pathname | string | The path of the current URL |
| search | string | The query string, including the leading ? |
| hash | string | The URL hash, including the leading # |
| state | any | State passed via Link or navigate |
| key | string | A unique key for this location entry |
The useSearchParams hook reads and updates the query string. It works like useState: you get the current params and a function to change them.
<Link> for standard navigation links.<NavLink> for navigation menus that need active-state styling.useNavigate for programmatic navigation, such as redirects after a form or login.useParams to access dynamic route parameters.useSearchParams for managing query strings and filters.Create your first pages and wrap them in shared layouts.
Define routes from the filesystem with folder-based and file-based conventions.
Match URL segments with dynamic parameters and catch-alls.
Add backend endpoints with plain functions or a full Hono app.
Control titles, descriptions, and social previews per route.
Deploy to Node, Vercel, Netlify, Cloudflare, or Deno, or build native apps in CI.