---
title: "Comment by Devesh Kumar on \"How to Close Modal by Clicking Outside The Modal\" | Hashnode"
description: "we can use useEffect hook in react for this purpose, isn&#39;t we."
url: "https://hashnode.com/posts/how-to-close-modal-by-clicking-outside-the-modal/657ae859df5d4c3ea6cfa5af/comment/657efc4503e6d4749ad8a19b"
---

[Discussion](https://hashnode.com/posts/how-to-close-modal-by-clicking-outside-the-modal/657ae859df5d4c3ea6cfa5af)

Comment [How to Close Modal by Clicking Outside The Modal](https://hashnode.com/posts/how-to-close-modal-by-clicking-outside-the-modal/657ae859df5d4c3ea6cfa5af)

[Devesh Kumar](https://hashnode.com/@dev530)

[Dec 17, 2023](https://hashnode.com/posts/how-to-close-modal-by-clicking-outside-the-modal/657ae859df5d4c3ea6cfa5af/comment/657efc4503e6d4749ad8a19b)

we can use useEffect hook in react for this purpose, isn't we.

[Segun Ajibola](https://hashnode.com/@segunajibola)

[Dec 18, 2023](https://hashnode.com/posts/how-to-close-modal-by-clicking-outside-the-modal/657ae859df5d4c3ea6cfa5af/comment/657efc4503e6d4749ad8a19b#reply-6580ae880322c401839296f4)

yes, surely.

[Segun Ajibola](https://hashnode.com/@segunajibola)

[Dec 18, 2023](https://hashnode.com/posts/how-to-close-modal-by-clicking-outside-the-modal/657ae859df5d4c3ea6cfa5af/comment/657efc4503e6d4749ad8a19b#reply-6580aea00322c40183929744)

thanks for checking this out.
