Tiger Router is a minimalist routing library for React, now fully rewritten in TypeScript with complete type definitions. It provides a lightweight, framework-agnostic core with modern React bindings.
Unlike heavyweight alternatives, Tiger Router focuses on simplicity and essential routing features without the bloat.
- β
TypeScript First - Full type safety with generated
.d.tsfiles - β Minimalist Core - Framework-agnostic history and route matching
- β
Modern React Hooks -
useLocation,useNavigate,useParams,useRouteMatch - β Tiny Bundle - Keep your app lightweight
- β ESM & CJS - Works with modern and legacy build systems
npm install tiger-router
# or
yarn add tiger-router
# or
pnpm install tiger-routerimport { Router, Route, Link, useParams } from "tiger-router";
function User() {
const params = useParams();
return <div>User ID: {params.id}</div>;
}
export function App() {
return (
<Router>
<nav>
<Link to="/">Home</Link>
<Link to="/users/123">User 123</Link>
</nav>
<Route path="/" element={<div>Home</div>} />
<Route path="/users/:id" element={<User />} />
</Router>
);
}The main router component that manages navigation state.
Props:
mode?: 'history' | 'hash'- Routing mode (default:'history')children: ReactNode- Child routes and components
Renders a component when the path matches.
Props:
path: string- URL pattern (supports:paramsyntax)element?: ReactNode- Component to render on matchchildren?: ReactNode- Alternative toelement
Navigation component that prevents full page reloads.
Props:
to: string- Target pathchildren: ReactNode- Link content- All standard
<a>attributes
Returns the current location path.
Returns a function to programmatically navigate.
Returns route parameters as an object.
Returns true if the given path matches the current location.
Tiger Router is intentionally minimal. It doesn't include:
- Data loaders
- Complex nested routing
- Route guards
- Lazy loading utilities
If you need these features, consider React Router. If you want simplicity, Tiger Router is for you. π―
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.