Catalog npm
PACKAGE EXPLORERView in registry

0x1-router

npm

A lightweight, type-safe client-side router for JavaScript and TypeScript applications.

Versions collected19
Direct dependencies1From release 0.0.20
Last observed20 Oct, 17:49 UTC

README

Current package documentation

0x1-router

A lightweight, type-safe client-side router for JavaScript and TypeScript applications.

Features

  • 🌐 Simple client-side routing
  • 🔒 Type-safe with full TypeScript support
  • 📦 JSX-compatible Link component
  • 🪝 React-style hooks API
  • 🪶 Tiny footprint with zero dependencies
  • 🎯 History API integration

Installation

# Using bun
bun add 0x1-router

# Using npm
npm install 0x1-router

# Using yarn
yarn add 0x1-router

Basic Usage

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>
  );
}

API Reference

Components

JSX component for navigation links.

Props:

  • href: string - The target path
  • className?: string - CSS class name
  • children: any - Link content

Route

Renders the component for the current route.

Hooks

useRouter()

Returns router utilities:

  • navigate(path: string) - Navigate to a path
  • currentPath: string - Current route path
  • addRoute(route: Route) - Add a route definition
  • getCurrentRoute() - Get current route object

Types

Route

interface Route {
  path: string;
  component: () => JSX.Element;
  exact?: boolean;
}

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 19

Collected releases
VersionPublishedDirect dependenciesOpen version
0.0.20Registry latest25 Jun 20251
0.0.1824 Jun 20251
0.0.1710 Jun 20251
0.0.166 Jun 20251
0.0.155 Jun 20251
0.0.145 Jun 20251
0.0.135 Jun 20251
0.0.124 Jun 20251
0.0.114 Jun 20251
0.0.103 Jun 20251
0.0.92 Jun 20251
0.0.82 Jun 20251
0.0.729 May 20251
0.0.627 May 20251
0.0.527 May 20251
0.0.427 May 20251
0.0.327 May 20251
0.0.227 May 20251
0.0.127 May 20251

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
triex/0x1

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:49 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:5c9bb5487f7468fb321e8773bb7f7e286dc905d204727f9a3c70856f26266cbf