@supunlakmal/hooks
Version:
A collection of reusable React hooks
9 lines (8 loc) • 384 B
TypeScript
/**
* Custom hook to execute a callback function when the browser's route changes.
* This detects changes from popstate (back/forward buttons) and programmatic
* navigation via history.pushState and history.replaceState.
*
* @param {() => void} onChange - The callback function to execute on route change.
*/
export declare const useRouteChange: (onChange: () => void) => void;