Observed since 20 Oct, 17:26 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A lightweight, modern, and powerful React routing library with declarative routing, dynamic parameters, lazy loading, and full browser history support
A lightweight, modern, and powerful React routing library built from scratch. Create single-page applications (SPAs) with declarative routing, dynamic parameters, lazy loading, and full browser history support.
<Router>, <Route>, and <Link> componentspath-to-regexpRouterErrorBoundarynpm install 07-navegation-router
yarn add 07-navegation-router
pnpm add 07-navegation-router
🌐 Full documentation and interactive examples are available on our GitHub Pages site:
The documentation site includes:
import { Router, Route, Link } from "07-navegation-router";
function App() {
return (
<Router>
<nav>
<Link to="/">Home</Link>
<Link to="/about">About</Link>
<Link to="/users/123">User Profile</Link>
</nav>
<Route path="/" Component={Home} />
<Route path="/about" Component={About} />
<Route path="/users/:id" Component={UserProfile} />
<Route path="/404" Component={NotFound} />
</Router>
);
}
function Home() {
return (
<div>
<h1>Home Page</h1>
<Link to="/about">Go to About</Link>
</div>
);
}
function About() {
return (
<div>
<h1>About Page</h1>
<Link to="/">Back to Home</Link>
</div>
);
}
function UserProfile({ routeParams }) {
// Access route parameters
return <h1>User Profile #{routeParams.id}</h1>;
}
function NotFound() {
return <h1>404 - Page Not Found</h1>;
}
<Router>The main container component that enables routing in your application.
<Router defaultComponent={NotFound}>{/* Your routes go here */}</Router>
Props:
defaultComponent (React.Component, optional): Component to render when no route matches (404 handler)routes (Array, optional): Array of route objects for programmatic routingchildren (React.Node): Route components<Route>Defines a route with a specific path and component to render.
Props:
path (string): The URL path pattern (supports parameters like /users/:id)Component (React.Component): The component to render when the path matches<Route path="/products/:id" Component={ProductDetail} />
Route Parameters:
The matched component receives routeParams as a prop:
function ProductDetail({ routeParams }) {
const { id } = routeParams;
return <h1>Product {id}</h1>;
}
<Link>Declarative navigation component for client-side routing without page reloads.
Props:
to (string): The destination pathtarget (string, optional): Link target attribute (e.g., _blank)<a> element<Link to="/about">About Us</Link>
<Link to="/docs" target="_blank">Documentation</Link>
<Link to="/contact" className="nav-link">Contact</Link>
navigate(path)Programmatic navigation function for imperatively changing routes.
import { navigate } from "07-navegation-router";
function handleLogin() {
// Perform login logic
navigate("/dashboard");
}
<RouterErrorBoundary>Error boundary component for catching and handling routing errors gracefully.
Props:
fallback (React.Component | React.Element, optional): Custom error fallback UIchildren (React.Node): Components to wrapimport { Router, Route, RouterErrorBoundary } from "07-navegation-router";
function App() {
return (
<RouterErrorBoundary fallback={<ErrorPage />}>
<Router>
<Route path="/" Component={Home} />
<Route path="/error" Component={BuggyComponent} />
</Router>
</RouterErrorBoundary>
);
}
function ErrorPage({ error, resetError }) {
return (
<div>
<h1>Something went wrong</h1>
<pre>{error.message}</pre>
<button onClick={resetError}>Try again</button>
</div>
);
}
Access route parameters in your components:
import { Router, Route, Link } from "07-navegation-router";
function App() {
return (
<Router>
<Route path="/blog/:slug" Component={BlogPost} />
<Route path="/users/:userId/posts/:postId" Component={UserPost} />
</Router>
);
}
function BlogPost({ routeParams }) {
const { slug } = routeParams;
return <article>Post: {slug}</article>;
}
function UserPost({ routeParams }) {
const { userId, postId } = routeParams;
return (
<div>
User {userId}, Post {postId}
</div>
);
}
Improve performance by code-splitting your routes:
import { lazy, Suspense } from "react";
const Dashboard = lazy(() => import("./pages/Dashboard"));
function App() {
return (
<Router>
<Suspense fallback={<div>Loading...</div>}>
<Route path="/dashboard" Component={Dashboard} />
</Suspense>
</Router>
);
}
Define a default route for unmatched paths:
<Router>
<Route path="/" Component={Home} />
<Route path="/about" Component={About} />
<Route path="/404" Component={NotFound} />
</Router>
Use the navigate function for imperative routing:
import { navigate } from "07-navegation-router";
function LoginForm() {
const handleSubmit = async (e) => {
e.preventDefault();
const success = await login();
if (success) {
navigate("/dashboard");
window.scrollTo(0, 0); // Optional: scroll to top
}
};
return <form onSubmit={handleSubmit}>...</form>;
}
// Navigate with state
function goToProfile() {
navigate("/profile");
// The navigation event is automatically dispatched
}
Protect your routes with error boundaries:
import { RouterErrorBoundary, Router, Route } from "07-navegation-router";
function App() {
return (
<RouterErrorBoundary
fallback={({ error, resetError }) => (
<div>
<h2>Oops! Something went wrong</h2>
<details>
<summary>Error details</summary>
<pre>{error.message}</pre>
</details>
<button onClick={resetError}>Reset</button>
<button onClick={() => navigate("/")}>Go Home</button>
</div>
)}
>
<Router>
<Route path="/" Component={Home} />
<Route path="/risky" Component={RiskyComponent} />
</Router>
</RouterErrorBoundary>
);
}
Full TypeScript definitions are included:
import {
Router,
Route,
Link,
navigate,
RouterErrorBoundary,
} from "07-navegation-router";
import type { RouteParams, RouteComponentProps } from "07-navegation-router";
interface UserProfileProps extends RouteComponentProps {
routeParams: {
id: string;
};
}
const UserProfile: React.FC<UserProfileProps> = ({ routeParams }) => {
return <h1>User {routeParams.id}</h1>;
};
// Type-safe navigation
navigate("/users/123");
navegation-router/
├── src/
│ ├── components/
│ │ ├── Router.jsx # Main router component
│ │ ├── Route.jsx # Route definition component
│ │ ├── Link.jsx # Navigation link component
│ │ ├── ErrorBoundary.jsx # Error boundary component
│ │ ├── Router.test.jsx # Router tests (13 tests)
│ │ ├── Link.test.jsx # Link tests (10 tests)
│ │ └── Route.test.jsx # Route tests (5 tests)
│ ├── utils/
│ │ ├── consts.js # Constants
│ │ ├── getCurrentPath.js # Path utility
│ │ └── navigation.js # Navigation utilities
│ ├── index.jsx # Main entry point
│ └── navigation.js # Navigation exports
├── lib/ # Compiled output (published to npm)
├── docs/ # Documentation site
├── examples/ # Interactive examples
├── benchmarks/ # Performance benchmarks
├── .github/workflows/ # CI/CD pipelines
│ ├── ci.yml # Test & lint automation
│ └── pages.yml # GitHub Pages deployment
├── package.json
├── LICENSE # MIT License
├── CHANGELOG.md # Version history
├── CONTRIBUTING.md # Contribution guidelines
└── README.md
This library is thoroughly tested using:
Test Coverage:
npm run test # Run tests once
npm run test:watch # Watch mode
npm run test:ui # UI mode
npm run bench # Run performance benchmarks
Benchmarks show excellent performance:
Run benchmarks yourself:
npm run bench
# Install dependencies
npm install
# Run development server
npm run dev
# Build the library
npm run prepare
# Run tests
npm run test
Contributions are welcome! Please read our Contributing Guidelines before submitting a Pull Request.
git checkout -b feature/AmazingFeature)npm test)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)See CONTRIBUTING.md for detailed guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
Carlos Caño Gómez
path-to-regexp for advanced pattern matchingSee CHANGELOG.md for a detailed version history.
Latest Release: v0.3.1
react, router, routing, spa, single-page-application, navigation, react-router, client-side-routing, declarative-routing, dynamic-routes, lazy-loading, history-api, browser-history, lightweight-router, minimal-router
Visit our Documentation Site for:
Made with ❤️ by Carlos Caño Gómez
If you find this project useful, please consider:
Happy routing! 🚀
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.3.3Registry latest | 18 Oct 2025 | 20 | |
| 0.3.2 | 18 Oct 2025 | 20 | |
| 0.3.1 | 18 Oct 2025 | 20 | |
| 0.3.0 | 18 Oct 2025 | 20 | |
| 0.2.1 | 18 Oct 2025 | 20 | |
| 0.2.0 | 18 Oct 2025 | 20 | |
| 0.1.7 | 18 Oct 2025 | 19 | |
| 0.1.6 | 18 Oct 2025 | 19 | |
| 0.1.5 | 18 Oct 2025 | 19 | |
| 0.1.4 | 18 Oct 2025 | 19 | |
| 0.1.3 | 18 Oct 2025 | 19 | |
| 0.1.2 | 30 Sept 2024 | 19 | |
| 0.1.1 | 30 Sept 2024 | 19 | |
| 0.1.0 | 30 Sept 2024 | 19 | |
| 0.0.9 | 30 Sept 2024 | 19 | |
| 0.0.8 | 30 Sept 2024 | 19 | |
| 0.0.7 | 30 Sept 2024 | 19 | |
| 0.0.6 | 30 Sept 2024 | 19 | |
| 0.0.5 | 30 Sept 2024 | 19 | |
| 0.0.4 | 30 Sept 2024 | 19 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Public sponsor counts have not been collected. These signals belong to the repository owner.
github · 1 observations shown. Missing days are unknown.
| Date / source period | Value | Observed at |
|---|---|---|
| 2026-10-21 | 0 | 2026-10-21T14:19:16.0387780Z |
Observed since 20 Oct, 17:26 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:0a750f5688129f3000e86c4573ff56cffaaaa5870d1da95c3b0b98872be5b1a1