---
title: "Comment by Tarun Sharma on \"Stop Using useEffect for Derived State in React\" | Hashnode"
description: "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"
url: "https://hashnode.com/posts/stop-using-useeffect-for-derived-state-in-react/6ad986074069ef078f107a68/comment/6adaf2ad0a82624ab98735fa"
---

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

Comment [Stop Using useEffect for Derived State in React](https://hashnode.com/posts/stop-using-useeffect-for-derived-state-in-react/6ad986074069ef078f107a68)

[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.
