Show tooltip on selected text using custom hook
If you are an avid reader of content on websites like Medium.com or even here at Hashnode.com, you may have noticed this feature:
This is a tooltip that appears when you select a portion of text on these websites. Today, we will recreate this same f...
devcodesthings.hashnode.dev8 min read
Noël Cserépy
I build animated web apps with NextJS and Framer Motion.
Very cool! I never knew that selection has so much cool stuff to fiddle around with.
A quick question: wouldn't you want to return an
unsubscribe()function from the event listener in youruseEffect()to clean up the listener when the component unmounts?Thanks for the article :D