React HOC OutsideClick
A Higher Order Component wrapper to provide click outside functionality to the components
How to use
- Import
clickOutside
component - Wrap your main component with function the
clickOutside
- Provide an
onClickOutside
callback.
Example
;/* Any component, which will be set onClickOutside */;; state = isOpened: false { this; } { const wrapClickDiv = ; return <wrapClickDiv onClickOutside=thishandleClickOutside> Any content </wrapClickDiv> }); ;
Options:
Name | Description | Required |
---|---|---|
onClickOutside | function that is called when a click happened outside of the component | yes |
License
MIT