A lot of things happened between May and now. I was busy watching tv, eating, sleeping, and playing with our puppy.


You can do really cool things in react. One of the core concepts of react is composing reusable components. React hooks allow you to reuse even more logic! For more info please refer to Facebook’s react documentation.

One of the problems I was struggling to solve was how to detect clicks outside a context menu to close it. When I started learning react a few years ago, I was only able to implement toggling the menu open / close via the original button that triggers the opening.

Here is how you can implement this with a react hook.

I hoped this help! Feel free to ask any questions on my implementation or share your own implementation! Let’s learn from each other! 👌 🔥


I had medium for awhile, but I never really found a topic that I could write about. I was going to write about video games, but my interest mostly diminished. My true passion is in programming and software technologies.

It started when I was half way through college. I was…

Eric Dong

Software Eng. at GDMS, Dev Blogger

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store