Current collected state Current
Observed since 20 Oct, 17:49 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A lightweight, type-safe client-side router for JavaScript and TypeScript applications.
A lightweight, type-safe client-side router for JavaScript and TypeScript applications.
# Using bun
bun add 0x1-router
# Using npm
npm install 0x1-router
# Using yarn
yarn add 0x1-router
import { Link, Route, useRouter } from '0x1-router';
// Navigation with Link component
function Nav() {
return (
<nav>
<Link href="/" className="nav-link">Home</Link>
<Link href="/about" className="nav-link">About</Link>
<Link href="/contact" className="nav-link">Contact</Link>
</nav>
);
}
// Programmatic navigation
function HomePage() {
const { navigate } = useRouter();
const goToAbout = () => {
navigate('/about');
};
return (
<div>
<h1>Home Page</h1>
<button onClick={goToAbout}>Go to About</button>
</div>
);
}
// Route definition and rendering
const router = useRouter();
router.addRoute({
path: '/',
component: HomePage,
exact: true
});
router.addRoute({
path: '/about',
component: AboutPage
});
// Render current route
function App() {
return (
<div>
<Nav />
<Route />
</div>
);
}
LinkJSX component for navigation links.
Props:
href: string - The target pathclassName?: string - CSS class namechildren: any - Link contentRouteRenders the component for the current route.
useRouter()Returns router utilities:
navigate(path: string) - Navigate to a pathcurrentPath: string - Current route pathaddRoute(route: Route) - Add a route definitiongetCurrentRoute() - Get current route objectRouteinterface Route {
path: string;
component: () => JSX.Element;
exact?: boolean;
}
MIT
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.0.20Registry latest | 25 Jun 2025 | 1 | |
| 0.0.18 | 24 Jun 2025 | 1 | |
| 0.0.17 | 10 Jun 2025 | 1 | |
| 0.0.16 | 6 Jun 2025 | 1 | |
| 0.0.15 | 5 Jun 2025 | 1 | |
| 0.0.14 | 5 Jun 2025 | 1 | |
| 0.0.13 | 5 Jun 2025 | 1 | |
| 0.0.12 | 4 Jun 2025 | 1 | |
| 0.0.11 | 4 Jun 2025 | 1 | |
| 0.0.10 | 3 Jun 2025 | 1 | |
| 0.0.9 | 2 Jun 2025 | 1 | |
| 0.0.8 | 2 Jun 2025 | 1 | |
| 0.0.7 | 29 May 2025 | 1 | |
| 0.0.6 | 27 May 2025 | 1 | |
| 0.0.5 | 27 May 2025 | 1 | |
| 0.0.4 | 27 May 2025 | 1 | |
| 0.0.3 | 27 May 2025 | 1 | |
| 0.0.2 | 27 May 2025 | 1 | |
| 0.0.1 | 27 May 2025 | 1 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 17:49 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:5c9bb5487f7468fb321e8773bb7f7e286dc905d204727f9a3c70856f26266cbf