Drum machine works unless

My drum machine works until I put the setPlayClip state under where it says audio.play

function playSound(selector){
const audio = document.getElementById(selector);

without setPlayClip there, the audio plays just fine. But if it’s there, there’s no audio. But I need setPlayClip in there to make the text appear in the display window. Please help

Move the PadList class component out of the App function component and pass it the playSound function as a prop. Or don’t use a component at all and just map the array inside App (either in the JSX or before).

Also, you can’t have playClip as a value on an input element. The test looks at the element with the display id and its content.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.