paint-brush
Custom React Hook For Tracking Clicks Outside of the Componentby@welly
1,291 reads
1,291 reads

Custom React Hook For Tracking Clicks Outside of the Component

by welly4mJanuary 26th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

React hook is a React hook to trigger callback when user clicks outside of the target component(s) area. It's a useful logic for UI interaction design (IxD) like dismiss a dropdown menu, modal or tooltip etc. Uses passive event listeners to improve scrolling performance. Ignores certain elements during the event loop by the ignore-onclickoutside CSS class name. Disabling the event listener is a feature that can only be set as true once you set it as true, the callback won't be triggered.

Company Mentioned

Mention Thumbnail
featured image - Custom React Hook For Tracking Clicks Outside of the Component
welly HackerNoon profile picture
welly

welly

@welly

Code x Design ✨

About @welly
LEARN MORE ABOUT @WELLY'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

welly HackerNoon profile picture
welly@welly
Code x Design ✨

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite