Outside click event (for a ref) as a React hook.
Arguments | Type | Description | Default value |
---|---|---|---|
ref | React.MutableRefObject | Ref whose outside click needs to be listened to | |
handler | function | Callback to fire on outside click | |
when | boolean | A boolean which activates the hook only when it is true. Useful for conditionally enable the outside click | true |
No return value.
Join our discord server! You can click the floating discord icon at the bottom right of the screen and chat with us!