---
title: "Discussion on \"Writing my first custom react hook - useOutsideClick\" | Hashnode"
description: "Discussion on \"Writing my first custom react hook - useOutsideClick\". My first react custom hook in my first blog post"
url: "https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Writing my first custom react hook - useOutsideClick](https://blog.rajatkapoor.me/writing-my-first-custom-react-hook-useoutsideclick?utm_source=hashnode&utm_medium=feed)

My first react custom hook in my first blog post

May 10, 2021 · 5 min read · blog.rajatkapoor.me  
Updated May 14, 2021  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#reacthooks](https://hashnode.com/tag/reacthooks)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#webdev](https://hashnode.com/tag/webdev)
-   [#2articles1week](https://hashnode.com/tag/2articles1week)

## Written by

[Rajat Kapoor](https://hashnode.com/@rajatkapoor)

@rajatkapoor · India

  
[View profile](https://hashnode.com/@rajatkapoor)

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

## Responses 5

Markdown supported · ⌘↵ to post

[Chris Achinga](https://hashnode.com/@chrisdevcode)

[May 16, 2021](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/60a14b5923723215ec2fd992)

This is great

[Rajat Kapoor](https://hashnode.com/@rajatkapoor)

[May 16, 2021](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/60a14b5923723215ec2fd992#reply-60a14b93b66a0b15ebfc9b7f)

Thank you Chris. Glad you liked it

[Rosius Ndimofor](https://hashnode.com/@Rosius)

[May 12, 2021](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/609c35fdb684eb4cd52c28cf)

Great read. Thanks for putting this out👏🏾

[Rajat Kapoor](https://hashnode.com/@rajatkapoor)

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

Thanks Rosius

[Catalin Pit](https://hashnode.com/@Catalinpit)

[May 12, 2021](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/609baedec798bd79ff8ed3e6)

Is this your first blog post? You write really well and you should keep them coming!

[Rajat Kapoor](https://hashnode.com/@rajatkapoor)

[May 12, 2021](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/609baedec798bd79ff8ed3e6#reply-609bd57c00bbde79d86a6794)

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

[Shad Mirza](https://hashnode.com/@iamshadmirza)

[May 11, 2021](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/609a1be81ea29f2c341e4075)

Great read. I think you should check out [Rooks Library for hooks](https://react-hooks.org/). It contains a lot of great hooks for all the common cases.

Also, I wanna suggest that you use `//` for comments inside the code. It's more readable.

[Rajat Kapoor](https://hashnode.com/@rajatkapoor)

[May 11, 2021](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/609a1be81ea29f2c341e4075#reply-609a23b221068818a5c652c0)

Thank you so much for the feedback. I have updated the code comments to use `//` instead of `#`

[Rajat Kapoor](https://hashnode.com/@rajatkapoor)

[May 11, 2021](https://hashnode.com/posts/writing-my-first-custom-react-hook-useoutsideclick/6099477221068818a5c643d4/comment/609a1be81ea29f2c341e4075#reply-609a24071ea29f2c341e4126)

`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
