---
title: "Discussion on \"Understanding State Updates in React: Using `setCount` Inside and Outside `useEffect`\" | Hashnode"
description: "Discussion on \"Understanding State Updates in React: Using `setCount` Inside and Outside `useEffect`\". Learn how to use `setCount` in React, inside and outside `useEffect`, to handle state updates and avoid stale closures"
url: "https://hashnode.com/posts/understanding-state-updates-in-react-using-setcount-inside-and-outside-useeffect/67054d7cd172da8e5ac1a57c"
---

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

Discussion

# [Understanding State Updates in React: Using \`setCount\` Inside and Outside \`useEffect\`](https://codecrafters.hashnode.dev/understanding-state-updates-in-react-using-setcount-inside-and-outside-useeffect?utm_source=hashnode&utm_medium=feed)

Learn how to use \`setCount\` in React, inside and outside \`useEffect\`, to handle state updates and avoid stale closures

Oct 8, 2024 · 3 min read · codecrafters.hashnode.dev  
Updated Mar 30  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#useeffect](https://hashnode.com/tag/useeffect)
-   [#portfolio-learning](https://hashnode.com/tag/portfolio-learning)

## Written by

[Nitesh Singh](https://hashnode.com/@nik03)

@nik03

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

"Building the Web, One Line at a Time."

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
