react-router-lite
Version:
Similar to `react-router` but leaner.
42 lines (41 loc) • 1.45 kB
TypeScript
import type * as types from './types';
import * as React from 'react';
import { go } from './go';
export type * from './types';
export { go };
export declare const context: React.Context<types.RouterContextValue>;
export interface RouterProps {
route: string;
go?: types.Go;
children?: React.ReactNode;
fullRoute?: string;
parent?: types.MatchData;
}
export declare const Router: React.FC<RouterProps>;
export declare const useMatch: (match: string | RegExp | types.Matcher, exact?: boolean) => types.MatchData;
export interface MatchProps {
render?: ((data: types.MatchData) => React.ReactNode) | React.ReactNode;
children?: ((data: types.MatchData) => React.ReactNode) | React.ReactNode;
match?: string | RegExp | types.Matcher;
exact?: boolean;
truncate?: boolean;
}
export declare const Match: React.FC<MatchProps>;
export declare const Route: React.FC<MatchProps>;
export interface SwitchProps {
children: React.ReactElement[];
}
export declare const Switch: React.FC<SwitchProps>;
export interface RedirectProps extends types.GoParams {
to: string;
}
export declare const Redirect: React.FC<RedirectProps>;
export interface LinkProps extends React.AllHTMLAttributes<any> {
replace?: boolean;
state?: any | ((props: LinkProps) => any);
to?: string;
a?: boolean;
external?: boolean;
comp?: string | React.ComponentType<any>;
}
export declare const Link: React.FC<LinkProps>;