UNPKG

frontend-hamroun

Version:

A lightweight frontend JavaScript framework with React-like syntax

61 lines 1.78 kB
export interface Route { path: string; component: any; props?: Record<string, any>; exact?: boolean; } export interface RouterState { location: { pathname: string; search: string; hash: string; }; params: Record<string, string>; navigate: (to: string, options?: NavigateOptions) => void; match: (path: string) => boolean; } export interface NavigateOptions { replace?: boolean; state?: any; } export declare const RouterContext: import("./types.js").Context<RouterState>; export declare function RouterProvider({ routes, children }: { routes: Route[]; children: any; }): any; export declare function Route({ path, component: Component, props }: Route): any; export declare function Switch({ children }: { children: any; }): any; export declare function Link({ to, replace, state, className, activeClassName, children, ...rest }: { to: string; replace?: boolean; state?: any; className?: string; activeClassName?: string; children: any; [key: string]: any; }): any; export declare function Redirect({ to, replace }: { to: string; replace?: boolean; }): null; export declare function useLocation(): { pathname: string; search: string; hash: string; }; export declare function useParams(): Record<string, string>; export declare function useNavigate(): (to: string, options?: NavigateOptions) => void; declare const _default: { RouterProvider: typeof RouterProvider; Route: typeof Route; Switch: typeof Switch; Link: typeof Link; Redirect: typeof Redirect; useLocation: typeof useLocation; useParams: typeof useParams; useNavigate: typeof useNavigate; }; export default _default; //# sourceMappingURL=client-router.d.ts.map