Build an image carousel as a single React component. Four colored slides sit stacked in a viewport; the carousel advances itself on a timer, pauses while the pointer is over it, and offers manual controls. The whole trick is one timer and one index — and making sure that timer is created and cleared at exactly the right moments so intervals never pile up.
The starter App.tsx renders the carousel in its resting state — slide 1 showing, arrows, and four dots with the first one active — but nothing moves. Make it work:
index with useState(0).useEffect, setInterval every 3000ms to advance setIndex((i) => (i + 1) % 4). Return a cleanup that clearIntervals it.onMouseEnter pauses autoplay; onMouseLeave resumes it.index.useEffect cleanup must clearInterval — otherwise each re-run stacks another interval and the carousel races.setIndex((i) => (i + 1) % 4) reads the latest index, so the effect doesn't need index in its deps (which would re-create the timer every tick).(i + step + 4) % 4 for the arrows so Prev from slide 1 lands on slide 4.styles.css; focus on the state and the timer.