Fix the Stale Counter
Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.
The problem
- medium
- Pro
A component shows a counter that should go up by one every second. It keeps the count in state, and an effect with an empty dependency list starts an interval that sets the count to the current count plus one. On screen, the counter goes from zero to one and then stays at one. Explain why, and how you'd fix it.
Talk this problem through with an AI coach
This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.