---
title: "Discussion on \"UseEffect  hook explained React\" | Hashnode"
description: "Discussion on \"UseEffect  hook explained React\". React useEffect hook"
url: "https://hashnode.com/posts/useeffect-hook-explained-react/62ebea91f583cc2636e53934"
---

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

Discussion

# [UseEffect hook explained React](https://sanathan.hashnode.dev/useeffect-hook-explained-react?utm_source=hashnode&utm_medium=feed)

React useEffect hook

Aug 4, 2022 · 3 min read · sanathan.hashnode.dev  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#hooks](https://hashnode.com/tag/hooks)
-   [#reacthooks](https://hashnode.com/tag/reacthooks)
-   [#useeffect](https://hashnode.com/tag/useeffect)
-   [#javascript](https://hashnode.com/tag/javascript)

## Written by

[Sanathan](https://hashnode.com/@Sanathan)

@Sanathan

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

I am a frontend developer, sharing my learnings and Jounrey

## Responses 1

Markdown supported · ⌘↵ to post

[Nicolas Barlatier](https://hashnode.com/@NBA)

[Aug 4, 2022](https://hashnode.com/posts/useeffect-hook-explained-react/62ebea91f583cc2636e53934/comment/62ec05b9cbce7c268014e4da)

I don't really understand this part:

After being pushed to DOM function changes when DOM updated.

Could you rephrase it in better words and elaborate more with an example ?

[Sanathan](https://hashnode.com/@Sanathan)

[Aug 5, 2022](https://hashnode.com/posts/useeffect-hook-explained-react/62ebea91f583cc2636e53934/comment/62ec05b9cbce7c268014e4da#reply-62ec840ccbce7c268014f285)

useEffect(function , dependency) It is a callback function which is executed after another function has finished the execution

callback is executed right after changes were being pushed to DOM.

without using the useEffect we can get output as 'after 2 sec' from the count value.

In useEffect we setCount value as 'Hello world' , i.e only after the executed of the callback function ('after 2 sec) the DOM changes and got updated to ('Hello world')

i.e the function got updated from ('after 2 sec') to ('Hello world') right after excution of first state value and then setState value get change and update to DOM.
