Put in order · Vibe coding with Claude Code course · Module 11: Spotify clone
The effect with the ended listener
Arrange the lines of the effect that moves to the next track:
Items to put in order
- const audio = audioRef.current;
- if (!audio) return;
- return () => audio.removeEventListener("ended", handleEnded);
- audio.addEventListener("ended", handleEnded);
- useEffect(() => {
- }, [index, queue.length, repeat]);
You can check the correct answer by solving this task in the CodeWorlds game.