piral-hooks-utils
Version:
Hooks and HOC for pilets and Piral instances.
10 lines (9 loc) • 512 B
TypeScript
import type { History, Location } from 'history';
/**
* Hook to notify the user in case of potential data loss when
* performing a page transition (internal or external).
* @param active True if the prompt should be shown, otherwise false.
* @param history The history of the currently used router.
* @param message The message to display when the prompt is shown.
*/
export declare function usePrompt(active: boolean, history: History, message: string, onTransition?: (location: Location) => void): void;