react-router-magic
Version:
Like react-router but with magic inside
40 lines (39 loc) • 1.39 kB
TypeScript
/// <reference types="react" />
import { Component, ValidationMap, ReactType } from 'react';
import { Location } from 'history';
import { Store, RouterStoreState } from './Store';
import { Match, ValOrFunc } from './utils';
export declare type RouteProps = {
match?: ValOrFunc<Match>;
component?: ReactType;
render?: (params: RouteChildParams) => JSX.Element;
children?: ((params: RouteChildParams) => JSX.Element) | JSX.Element;
passif?: boolean;
switchIndex?: number;
};
export declare type RouteContext = {
routerStore: Store<RouterStoreState>;
};
export declare type RouteChildContext = {
routerStore: Store<RouterStoreState>;
};
export declare type RouteChildParams = {
match: Match;
location: Location;
};
export declare class Route extends Component<RouteProps, {}> {
static displayName: string;
static childContextTypes: ValidationMap<any>;
static contextTypes: ValidationMap<any>;
context: RouteContext;
private routerStore;
private matchResult;
private unsubscribe;
private isUnmounted;
constructor(props: RouteProps, context: RouteContext);
getChildContext(): RouteChildContext;
UNSAFE_componentWillReceiveProps(nextProps: RouteProps): void;
componentWillUnmount(): void;
render(): JSX.Element | null;
private update(props, forceUpdate?);
}