react-router-last-location
Version:
Provides access to the last location in react + react-router (v4.x) apps. Useful for handling internal routing. Easily prevent leaving your app by users.
20 lines (19 loc) • 1.36 kB
TypeScript
import * as React from 'react';
import { RouteComponentProps } from 'react-router-dom';
import { LastLocationType } from './LastLocationContext';
interface Props extends RouteComponentProps {
watchOnlyPathname: boolean;
children: React.ReactNode;
}
export declare const getLastLocation: () => LastLocationType;
export declare const setLastLocation: (nextLastLocation: LastLocationType) => void;
declare const _default: React.ComponentClass<Pick<Pick<Pick<Pick<Props, "location" | "history" | "match" | "staticContext" | "children">, "location" | "history" | "match" | "staticContext" | "children"> & Pick<{
watchOnlyPathname?: boolean | undefined;
}, never> & Pick<{
watchOnlyPathname?: boolean | undefined;
}, "watchOnlyPathname">, "location" | "history" | "match" | "staticContext" | "children" | "watchOnlyPathname">, "children" | "watchOnlyPathname">, any> & import("react-router").WithRouterStatics<React.ComponentClass<Pick<Pick<Pick<Props, "location" | "history" | "match" | "staticContext" | "children">, "location" | "history" | "match" | "staticContext" | "children"> & Pick<{
watchOnlyPathname?: boolean | undefined;
}, never> & Pick<{
watchOnlyPathname?: boolean | undefined;
}, "watchOnlyPathname">, "location" | "history" | "match" | "staticContext" | "children" | "watchOnlyPathname">, any>>;
export default _default;