react-router-magic
Version:
Like react-router but with magic inside
32 lines (31 loc) • 1.08 kB
TypeScript
/// <reference types="react" />
import { Component, ValidationMap } from 'react';
import { History } from 'history';
import { Store, RouterStoreState } from './Store';
import { Match, ValOrFunc, ToProps } from './utils';
export declare type RedirectPropsTyped<P> = {
to: ToProps;
match?: ValOrFunc<Match>;
push?: boolean;
noSubscribe?: boolean;
switchIndex?: number;
};
export declare type RedirectProps = RedirectPropsTyped<any>;
export declare type RedirectContext = {
routerStore: Store<RouterStoreState>;
router: {
history: History;
};
};
export declare class Redirect extends Component<RedirectProps, {}> {
static displayName: string;
static contextTypes: ValidationMap<any>;
context: RedirectContext;
private unsubscribe;
constructor(props: RedirectProps, context: RedirectContext);
componentDidMount(): void;
UNSAFE_componentWillReceiveProps(nextProps: RedirectProps): void;
render(): JSX.Element | null;
componentWillUnmount(): void;
private update(props);
}