/use-lifo-click-outside

🎯 Detect clicks outside of elements and close components in reverse order

Primary LanguageTypeScriptMIT LicenseMIT

⚛️ useLifoClickOutside()

npm-version

📡 Detect clicks outside of elements and close components in reverse order.

Installation

npm i use-lifo-click-outside

Usage

import { useLifoClickOutside } from 'use-lifo-click-outside';

useLifoClickOutside(ref, onClose);

<Portal>
  <Modal ref={ref}>
    ...
  </Modal>
</Portal>