Installation
npm
npm i use-exit-intent
pnpm
pnpm i use-exit-intent
yarn
yarn add use-exit-intent
Importing
import { useExitIntent } from 'use-exit-intent'
Using
In your React component:
export function App() { const { registerHandler } = useExitIntent() registerHandler({ id: 'openModal', handler: () => console.log('Hello from handler!') }) // ... }