My drum machine works until I put the setPlayClip state under where it says audio.play
function playSound(selector){
const audio = document.getElementById(selector);
audio.play();
setPlayClip(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.