UNPKG

react-router-magic

Version:
36 lines (35 loc) 1.4 kB
/// <reference types="react" /> import { Component, ValidationMap, ReactElement, ReactNode } from 'react'; import { Store, RouterStoreState } from './Store'; import { RouteProps, RouteChildContext } from './Route'; import { RedirectProps } from './Redirect'; export declare type SwitchProps = { children?: ReactNode; renderContainer?: (children: ReactElement<(RouteProps | RedirectProps)>[]) => JSX.Element; }; export declare type SwitchContext = { routerStore: Store<RouterStoreState>; }; /** * Render the first Route that match * To do so, Switch take the passed children and test their match props * It find the first match and pass in a swtichIndex in context */ export declare class Switch extends Component<SwitchProps, {}> { static displayName: string; private routerStore; private validChildren; static childContextTypes: ValidationMap<any>; static contextTypes: ValidationMap<any>; context: SwitchContext; private unsubscribe; private isUnmounted; constructor(props: SwitchProps, context: SwitchContext); getChildContext(): RouteChildContext; UNSAFE_componentWillReceiveProps(nextProps: SwitchProps): void; componentWillUnmount(): void; render(): JSX.Element; private defaultRenderContainer(children); private updateValidChildren(props); private update(props, forceUpdate?); }