Skip to content

Damilola Ogunleye

@dami_learns

bootcamp grad (frontend) 🎓 ibadan. looking for my first role. learning in public, be nice

  • Ibadan, Nigeria
  • Yoruba · English
  • Joined Oct 2026
  • Last posted Oct 19, 2026
Posts
1
Followers
7
Following
13
Reputation
35

Posts

Everything this author has published.

7

  • Accepted answer

    ah this one na classic. the interval callback catch "seconds" when it was 0, and because your useEffect get [] e no go run again, so every second e dey do 0 + 1. forever 1 😂 fix am like this: useEffect(() => { const id = setInterval(() => { setSeconds((s) => s + 1) }, 1000) return () => clearInterval(id) }, []) setSeconds((s) => s + 1) means "take whatever the current value is and add 1", so e no care about the old captured value. the clearInterval part is important too. without it, StrictMode go run your effect twice in dev, you go get two intervals, timer go dey count double speed and you go think say na witchcraft
    1 reply

Get the best of Dynamo Geeks weekly

One email each Monday with the most useful posts. No spam; unsubscribe in one click.