Is there any alternative to just keeping a "clock" in the background to implement auto-next (after a few seconds) in carousel using react hooks? The custom react hook below implements a state for a carousel that supports manual (next, prev, reset) and automatic (start, stop) methods for changing the carousel's current (active) index. const useCarousel = (items = []) => { const [current, setCurrent] = useState( items && items.length > 0 ? 0 : undefined ); const [auto, setAuto] = useState(false); const next = () => setCurrent((current + 1) % items.length); const prev = () => setCurrent(current ?