UNPKG

react-before-leave

Version:

React component and hook which listens to `beforeunload` on the window when mounted.

11 lines (10 loc) 398 B
import React from 'react'; export interface IBeforeLeaveOptions { message: string; enableUnload?: boolean; enableRouter?: boolean; path?: string; exact?: boolean; } export declare const useBeforeleave: ({ message, exact, path, enableUnload, enableRouter, }: IBeforeLeaveOptions) => void; export declare const BeforeLeave: React.FunctionComponent<IBeforeLeaveOptions>;