A sample project react hook (in typescript) to detect click events outside an element.
Many thanks at Pitipat Srichairat for his article.
Ths project contains 3 same dropdown element with a different implementation:
- DropdownNoneHooks: dropdown normal extends React.Component with state, ...
- DropdownWithHooks: dropdown with hook in the FunctionComponent and all hooks are integrated in the code
- DropdownWithCallback: dropdown with hook in the FunctionComponent but a generic hook (useClickOutside) is external of the function for reusing