UNPKG

react-lightweight-router

Version:

A lightweight, type-safe routing solution for React applications with support for dynamic route parameters

36 lines (28 loc) 814 B
import { JSX } from 'react/jsx-runtime'; import { JSX as JSX_2 } from 'react'; export declare const Link: ({ to, children, }: { to: string; children: React.ReactNode; }) => JSX.Element; export declare const Route: ({ path, element, }: { path: string; element: JSX_2.Element; }) => JSX_2.Element | null; export declare const Router: ({ children }: { children: React.ReactNode; }) => JSX.Element; declare interface RouterContextType { path: string; navigate: (to: string) => void; params: { [key: string]: string; }; setParams: (params: { [key: string]: string; }) => void; } export declare const useParams: () => { [key: string]: string; }; export declare const useRouter: () => RouterContextType; export { }