use-toggle-and-outclick
React hook for controlling the state of any dropdowns that need an outclick for closing
Install
yarn add use-toggle-and-outclick
Usage
; const ExampleControl = { const isDropOpened dropRef toggleDrop closeExplicitly = ; /** * isDropOpened - state field weather the dropdown is open now * dropRef - ref for dropdown dom-node (ref={dropRef}) * toggleDrop - function that toggles state * closeExplicitly - function that closes dropdown */ // ...};