---
title: "Discussion on \"A Look At React Hooks: useEffect\" | Hashnode"
description: "Discussion on \"A Look At React Hooks: useEffect\". Welcome to A Look at React Hooks, a beginner-friendly series on React Hooks. In this article, let's look at the useEffect Hook.\nWhat is useEffect?\nIf you are coming from the class-based React, the useEffect Hook replaces the componentDidMount, compon..."
url: "https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2"
---

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

Discussion

# [A Look At React Hooks: useEffect](https://blog.lo-victoria.com/a-look-at-react-hooks-useeffect?utm_source=hashnode&utm_medium=feed)

Welcome to A Look at React Hooks, a beginner-friendly series on React Hooks. In this article, let's look at the useEffect Hook. What is useEffect? If you are coming from the class-based React, the useEffect Hook replaces the componentDidMount, compon...

Feb 18, 2021 · 7 min read · blog.lo-victoria.com  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#tutorial](https://hashnode.com/tag/tutorial)
-   [#reacthooks](https://hashnode.com/tag/reacthooks)

## Written by

[Victoria Lo](https://hashnode.com/@victoria)

@victoria · Singapore

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

A nerd in books, tea, games and software.

I'm a solutions engineer lead, GitHub Star, Director of WomenDevsSG, and co founder of ragTech. I work at the intersection of tech, systems, and leadership, and this blog is where I share my journey through all three. Expect honest reflections, real experiences, and thoughts that are still forming rather than polished career advice.

## Responses 7

Markdown supported · ⌘↵ to post

[Amaan Ahmad](https://hashnode.com/@amaancodes)

[Feb 27, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/6039f9312b6fa36588f8125a)

Great article! I was exactly looking for some explanation about `useEffect()` , and here I found your article. Thanks for writing it 😊. Followed ✨

[Victoria Lo](https://hashnode.com/@victoria)

[Feb 27, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/6039f9312b6fa36588f8125a#reply-603a15e89aeaec6b8ed52e93)

Thanks! Glad you found it useful :)

[Idris Olubisi](https://hashnode.com/@olanetsoft)

[Feb 20, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/60316d20f51caf4448562542)

Thanks for sharing 😊 Looking forward to your next article

[Edidiong Asikpo (Didi)](https://hashnode.com/@didicodes)

[Feb 19, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/602f5b281591c5239ebdc56b)

Very insightful as always! Looking forward to the next article on this series.

[Victoria Lo](https://hashnode.com/@victoria)

[Feb 19, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/602f5b281591c5239ebdc56b#reply-602f6f56df37823860fe2593)

Thanks Didi 😊

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

[Feb 19, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/602f5af2bfecab23c3525449)

Great article as always, [Victoria Lo](https://hashnode.com/@victoria)! I enjoyed it, and it helped me understand useEffect! 😊

[Victoria Lo](https://hashnode.com/@victoria)

[Feb 19, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/602f5af2bfecab23c3525449#reply-602f6f67fc6983383b87764e)

Glad it helps Catalin! 😊

[Shamaayil Ahmed](https://hashnode.com/@shamaayil)

[Feb 19, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/602f4b451591c5239ebdc34b)

Would like to take this space to present my post on same topic

[shamaayil.hashnode.dev/react-hook-2-useeffect](https://shamaayil.hashnode.dev/react-hook-2-useeffect)

[Richard Harris](https://hashnode.com/@richard788)

[Feb 19, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/602f2f871591c5239ebdc1ae)

your articles always help me learn thx

[Victoria Lo](https://hashnode.com/@victoria)

[Feb 19, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/602f2f871591c5239ebdc1ae#reply-602f6faafc6983383b877656)

Thanks for your constant support 😊

[Favourite Jome](https://hashnode.com/@Favourite)

[Feb 18, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/602ec67abfecab23c3524d55)

Hello [Victoria Lo](https://hashnode.com/@victoria), I have a question.

I don't really understand why I should use a cleanup function in useEffect hook, so far all the little projects I've done using React I don't return the cleanup function.

If it's not too much to ask, could you give instances where I really need to return a cleanup function and what are the side effects of not returning a cleanup function?

[Favourite Jome](https://hashnode.com/@Favourite)

[Feb 19, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/602ec67abfecab23c3524d55#reply-602f65991591c5239ebdc757)

Thanks for the feedback [JC Lee](https://hashnode.com/@ljc_dev) I think I get it know.

But if it's a fetch call, there nothing to clean up right?

[JC Lee](https://hashnode.com/@ljc_dev)

[Feb 22, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/602ec67abfecab23c3524d55#reply-6033552ff51caf4448563b95)

[Jome Favourite](https://hashnode.com/@Favourite) No clean up but u'd want to add a logic to check whether u already fetched to prevent re-fetch. Like if(data) return

[Favourite Jome](https://hashnode.com/@Favourite)

[Feb 22, 2021](https://hashnode.com/posts/a-look-at-react-hooks-useeffect/602e6eecbfecab23c35247a2/comment/602ec67abfecab23c3524d55#reply-60335f1672a689446db3fb0b)

Okay, that'll be when I want to use the data. Thanks [JC Lee](https://hashnode.com/@ljc_dev)
