arrow_backBACK TO DRILLS
White BeltusereflockPREMIUM

useRef vs useState for interval IDs

A component needs to store a setInterval ID so it can later call clearInterval when the user clicks Stop. Which approach is most appropriate?

lock

This Drill is Locked

This is a premium drill. Continue on to the next free drill in the sequence.

CONTINUE DRILLarrow_forward
BugDojo
BlogFAQ

© 2026. Carved in code.