Skip to content

faustienf/use-lifo-click-outside

Repository files navigation

⚛️ 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>