During my internship. One day I was working on building some dropdown filters for our company's product. Initially, I thought yeah it's not too big a deal. I can simply store one state and render the list on setting the state as true. So initial phas...
Markdown supported · ⌘↵ to post
Bhargav Ponnapalli
Hashnoder | Frontend Developer | Youtuber
Good one Shivam Sharma.
I wrote a hook called to do this as well. Clicking outside is a very common feature for dropdowns, modals etc. So I made this hook.
react-hooks.org/docs/use-outside-click-ref Check it out if you get a chance!
Cheers!