reactant-router
Version:
A router plugin for Reactant
53 lines • 1.91 kB
TypeScript
import { PropsWithChildren, FunctionComponent } from 'react';
import { PluginModule } from 'reactant-module';
import type { ReducersMapObject } from 'redux';
import type { Location, LocationState, Action, History } from 'history';
export { createHashHistory, createBrowserHistory, createMemoryHistory, } from 'history';
export { LOCATION_CHANGE } from 'connected-react-router';
export type { LocationChangeAction } from 'connected-react-router';
declare const RouterOptions: unique symbol;
export interface RouterState {
action: Action;
location: Location<LocationState>;
}
export interface IRouterOptions {
/**
* create history for router, use `createHashHistory`/`createBrowserHistory`/`createMemoryHistory`
*/
createHistory: () => History;
/**
* Auto provider injection.
*/
autoProvide?: boolean;
/**
* auto create history and handle middleware
*/
autoCreateHistory?: boolean;
}
declare class ReactantRouter extends PluginModule {
protected options: IRouterOptions;
autoProvide: boolean;
protected history: History;
autoCreateHistory: boolean;
onLocationChanged: any;
routerActions: any;
protected readonly stateKey = "router";
constructor(options: IRouterOptions);
get store(): any;
beforeCombineRootReducers(reducers: ReducersMapObject): ReducersMapObject;
protected defaultHistory?: {
location: History['location'];
action: string;
};
ConnectedRouter: FunctionComponent;
get router(): RouterState | undefined;
get currentPath(): string | undefined;
push(path: string, state?: LocationState): void;
replace(path: string, state?: LocationState): void;
go(n: number): void;
goBack(): void;
goForward(): void;
provider: (props: PropsWithChildren<any>) => any;
}
export { ReactantRouter as Router, RouterOptions };
//# sourceMappingURL=router.d.ts.map