You Might Not Need an Effect

Talk it through out loud with your AI coach.

The problem

  • medium
  • Pro

A component stores a list of items and a filter, and uses an effect to copy the filtered list into a third piece of state whenever either changes. The screen flickers with stale results for a moment. Explain what's wrong and how you'd simplify it.

What a strong answer covers

  • Why copying derived data through an effect shows stale results first.
  • Working the value out during render instead of storing it.
  • When caching the calculation is worth it.
  • What effects are genuinely for.

Common mistake: Reaching for an effect whenever one value depends on another.

Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.

Practise it out loud