---
title: "Discussion on \"Stop Using useEffect for Derived State in React\" | Hashnode"
description: "Discussion on \"Stop Using useEffect for Derived State in React\". Calculate during render for simple values. Use a declarative model when relationships belong to a shared business graph."
url: "https://hashnode.com/posts/stop-using-useeffect-for-derived-state-in-react/6ad986074069ef078f107a68"
---

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

Discussion

# [Stop Using useEffect for Derived State in React](https://neurons-me.hashnode.dev/stop-using-useeffect-for-derived-state-in-react?utm_source=hashnode&utm_medium=feed)

Calculate during render for simple values. Use a declarative model when relationships belong to a shared business graph.

Oct 22 · 6 min read · neurons-me.hashnode.dev  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#webdev](https://hashnode.com/tag/webdev)
-   [#state-management](https://hashnode.com/tag/state-management)
-   [#architecture](https://hashnode.com/tag/architecture)

## Written by

[Sui Gn](https://hashnode.com/@neurons-me)

@neurons-me · Veracruz

  
[View profile](https://hashnode.com/@neurons-me)

Go Algorithmic.

○ universe → ⊙ identity → ● meaning

## Responses 2

Markdown supported · ⌘↵ to post

[Tarun Sharma](https://hashnode.com/@101beardo)

[Oct 23](https://hashnode.com/posts/stop-using-useeffect-for-derived-state-in-react/6ad986074069ef078f107a68/comment/6adaf2ad0a82624ab98735fa)

The extra render in the effect version is worse than wasted work. Children and their own effects see that in-between render with the old total, so an analytics call or a fetch keyed on total can fire once with the stale value before the corrected one lands. Calculating during render removes that window completely.

[Sui Gn](https://hashnode.com/@neurons-me)

[Oct 23](https://hashnode.com/posts/stop-using-useeffect-for-derived-state-in-react/6ad986074069ef078f107a68/comment/6adaf2ad0a82624ab98735fa#reply-6adb9b292c2643b1afba72d0)

Ha, I didn't even know that was a thing, thanks. That's actually why .me doesn't have that problem: there's no separate step for the total. When you write the quantity, the total is already updated, so nothing ever reads the old one in between.
