UNPKG

1.28 kBTypeScriptView Raw
1import * as React from "react";
2import type { History, Location } from "history";
3import { Action as NavigationType } from "history";
4import type { RouteMatch } from "./router";
5/**
6 * A Navigator is a "location changer"; it's how you get to different locations.
7 *
8 * Every history instance conforms to the Navigator interface, but the
9 * distinction is useful primarily when it comes to the low-level <Router> API
10 * where both the location and a navigator must be provided separately in order
11 * to avoid "tearing" that may occur in a suspense-enabled app if the action
12 * and/or location were to be read directly from the history instance.
13 */
14export declare type Navigator = Pick<History, "go" | "push" | "replace" | "createHref">;
15interface NavigationContextObject {
16 basename: string;
17 navigator: Navigator;
18 static: boolean;
19}
20export declare const NavigationContext: React.Context<NavigationContextObject>;
21interface LocationContextObject {
22 location: Location;
23 navigationType: NavigationType;
24}
25export declare const LocationContext: React.Context<LocationContextObject>;
26interface RouteContextObject {
27 outlet: React.ReactElement | null;
28 matches: RouteMatch[];
29}
30export declare const RouteContext: React.Context<RouteContextObject>;
31export {};