@guruhotel/aura-hooks
Version:
🪝 Hooks library designed by the Guruhotel team for Aura UI
1 lines • 246 B
JavaScript
import{useState as n}from"react";export function useDisclosure(o,l){const[e,u]=n(o),r=()=>{e||(u(!0),null==l||null==l.onOpen||l.onOpen())},s=()=>{e&&(u(!1),null==l||null==l.onClose||l.onClose())};return[e,{open:r,close:s,toggle:()=>{e?s():r()}}]}