---
title: "Rajat Kapoor (@rajatkapoor) | Hashnode"
description: "👨‍💻Engineering Lead @ Hashnode | Indiehacker | 🌏 Remote Work Advocate. Read the latest articles by Rajat Kapoor on Hashnode."
url: "https://hashnode.com/@rajatkapoor"
---

@rajatkapoor

# Rajat Kapoor

@rajatkapoor · India · Joined September 2020

👨‍💻Engineering Lead @ Hashnode | Indiehacker | 🌏 Remote Work Advocate

[Website](https://rajatkapoor.me/)

## Comments

[I never even thought the browsers would have events for gamepads. This is such a nice discovery for me :) Definitely going to try this one in some fun side project](https://hashnode.com/posts/playing-with-the-gamepad-api/6537e3a31b9ec032c3c29e11/comment/655c86a5619610754e1b8c14)

Comment · Article · Nov 21, 2023 · [Playing with the Gamepad API](https://hashnode.com/posts/playing-with-the-gamepad-api/6537e3a31b9ec032c3c29e11)

[Fantastic job Savio. You've done it again 🙌 The app looks fabulous and will be extremely helpful for all devs. And I love the explainer video. What did you use to create that?](https://hashnode.com/posts/introducing-code-house-biggest-store-of-cheat-sheets/60d98472703d372ea06c755b/comment/60d98ec368364a2e7b2cdda1)

Comment · Article · Jun 28, 2021 · [Introducing Code House - Biggest Store of Cheat sheets 👨‍💻](https://hashnode.com/posts/introducing-code-house-biggest-store-of-cheat-sheets/60d98472703d372ea06c755b)

[Thanks Rosius](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/609c35fdb684eb4cd52c28cf#reply-60a14ba623723215ec2fd9a2)

Reply · Article · May 16, 2021 · [Writing my first custom react hook - useOutsideClick](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4)

[Thank you Chris. Glad you liked it](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/60a14b5923723215ec2fd992#reply-60a14b93b66a0b15ebfc9b7f)

Reply · Article · May 16, 2021 · [Writing my first custom react hook - useOutsideClick](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4)

[Such a handy trick. Thanks for sharing](https://hashnode.com/posts/the-best-way-to-debug-css-code/609b51c600bbde79d86a55f9/comment/609be9eac798bd79ff8ede88)

Comment · Article · May 12, 2021 · [The Best Way To Debug CSS Code](https://hashnode.com/posts/the-best-way-to-debug-css-code/609b51c600bbde79d86a55f9)

[Such in depth articles are a rare find. Thanks for writing](https://hashnode.com/posts/css-flexbox/609a37e021068818a5c65631/comment/609be95500bbde79d86a6b1d)

Comment · Article · May 12, 2021 · [CSS Flexbox](https://hashnode.com/posts/css-flexbox/609a37e021068818a5c65631)

[Hey Catalin! This means a lot coming from you. Yes, this is my first post and I plan to continue writing as I learn. I have a blog series in mind where I will build my portfolio in public using next js and host it on vercel](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/609baedec798bd79ff8ed3e6#reply-609bd57c00bbde79d86a6794)

Reply · Article · May 12, 2021 · [Writing my first custom react hook - useOutsideClick](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4)

[Victor de la Fouchardière You are absolutely right here. Thanks for letting me know. For others wondering, I created a codepen to test out what Victor told me. You can check that out here: https://codesandbox.io/s/vibrant-heisenberg-5bzrf?file=/src/App.js](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/609a510321068818a5c659bf#reply-609ab3ac00bbde79d86a4e06)

Reply · Article · May 11, 2021 · [Writing my first custom react hook - useOutsideClick](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4)

[Hey! Thank you for reading. Having that ref in the useState dependencies ensure that things work when the element on which the ref is placed, unmounts and mounts. Imagine a case where clicking on a button shows a sidebar and we want to close the sidebar when the user clicks outside of the sidebar(and not the button). In this case the ref would be undefined as first, but would change later. And we would want to register the onOutsideClick again, passing in the new ref. Let me know if that doesn't make sense](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/609a510321068818a5c659bf#reply-609a96020375d467ca5c1c11)

Reply · Article · May 11, 2021 · [Writing my first custom react hook - useOutsideClick](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4)

[rooks is amazing. I have been a big fan of both rooks and react-use. I created this one just as a way to learn how to create custom react hooks](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/609a1be81ea29f2c341e4075#reply-609a24071ea29f2c341e4126)

Reply · Article · May 11, 2021 · [Writing my first custom react hook - useOutsideClick](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4)
