react-router-magic
Version:
Like react-router but with magic inside
32 lines (31 loc) • 961 B
TypeScript
/// <reference types="react" />
import { ComponentClass } from 'react';
import { Store, RouterStoreState } from './Store';
import { Match } from './utils';
import { History, Location } from 'history';
export declare type MagicRouterProviderContext = {
routerStore: Store<RouterStoreState>;
router: {
history: History;
};
};
export declare type Decorator<P> = (Target: any) => ComponentClass<P>;
export declare type InjectedMatch = {
match: Match;
};
export declare type InjectedLocation = {
location: Location;
};
export declare type InjectedHistory = {
history: History;
};
export declare type InjectedAll = InjectedMatch & InjectedLocation & InjectedHistory;
export declare type WhatToInject = {
match?: boolean;
location?: boolean;
history?: boolean;
};
/**
* Render the first Route that match
*/
export declare function InjectMagicRouter<P>(options?: WhatToInject): Decorator<P>;