FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
GitHub Copilot Stores Derived State in useEffect. This Is Why That Breaks Your App.
How-ToWeb Development

GitHub Copilot Stores Derived State in useEffect. This Is Why That Breaks Your App.

via Dev.to WebdevAvery3h ago

There is a pattern that shows up in almost every React project where AI was involved. It looks harmless. It works on first glance. And it silently creates bugs that are annoying to track down. It looks like this: const [total, setTotal] = useState(0) useEffect(() => { setTotal(items.reduce((sum, i) => sum + i.price, 0)) }, [items]) GitHub Copilot writes this confidently. No warnings. No errors. Just broken logic waiting to happen. What is actually wrong here Total is not state. Total is a calculation. It depends entirely on items. Every time items changes, total gets recalculated anyway. Storing it in useState and syncing it with useEffect adds a second source of truth that never needed to exist. The result is a component that renders twice when it should render once. State that is always one step behind. And a useEffect that exists for no reason other than that the AI had no rule against it. Why GitHub Copilot does this Copilot is not broken. It is pattern matching. It has seen thousa

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
0 views

Related Articles

Samsung Galaxy S26 and Galaxy S26+ Review: Lacking Ambition
How-To

Samsung Galaxy S26 and Galaxy S26+ Review: Lacking Ambition

Wired • 5h ago

5 kitchen splurges that I can't recommend enough
How-To

5 kitchen splurges that I can't recommend enough

ZDNet • 6h ago

Here’s how to rank the 50 best Apple products ever
How-To

Here’s how to rank the 50 best Apple products ever

The Verge • 6h ago

Fix Payment and Tax Issues in Museum Ticketing Software
How-To

Fix Payment and Tax Issues in Museum Ticketing Software

Dev.to Beginners • 7h ago

Difficulty vs Confusion in Tactical Games
How-To

Difficulty vs Confusion in Tactical Games

Medium Programming • 7h ago

Discover More Articles