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.
9 lines (8 loc) • 1.04 kB
TypeScript
import * as React from 'react';
import { RouteComponentProps } from 'react-router-dom';
import { getLastLocation } from './LastLocationProvider';
export interface WithLastLocationProps extends RouteComponentProps {
lastLocation: ReturnType<typeof getLastLocation>;
}
declare const withLastLocation: <WrappedProps extends WithLastLocationProps>(WrappedComponent: React.ComponentType<WrappedProps>) => React.ComponentClass<import("react-router").Omit<Pick<WrappedProps, import("./types").SetDifference<keyof WrappedProps, "location" | "lastLocation" | "history" | "match" | "staticContext">> & RouteComponentProps<{}, import("react-router").StaticContext, any>, "location" | "history" | "match" | "staticContext"> & {}, any> & import("react-router").WithRouterStatics<React.FunctionComponent<Pick<WrappedProps, import("./types").SetDifference<keyof WrappedProps, "location" | "lastLocation" | "history" | "match" | "staticContext">> & RouteComponentProps<{}, import("react-router").StaticContext, any>>>;
export default withLastLocation;