4 ms·
I don't think you need to hold id using useRef(). The cleanup callback holds the id from the same render, so it will clean up the correct interval.
by tuan 5y ago
I don't think you need to hold id using useRef(). The cleanup callback holds the id from the same render, so it will clean up the correct interval.