react-router-magic
Version:
Like react-router but with magic inside
20 lines (19 loc) • 535 B
TypeScript
import { Match } from './utils';
import { Location } from 'history';
export declare type RouterStoreState = {
location: Location;
match: Match;
switch: false | {
match: Match;
matchIndex: number | false;
};
};
export declare class Store<State> {
private listeners;
private state;
constructor(initialState: State);
setState(newState: State): this;
broadcast(state: State): void;
getState(): State;
subscribe(listener: (state: State) => void): () => void;
}