Hi,
Below is my code to play sound when user click the text link - using prop method, my text link is appearing in the browser but when I click the text link sound is not playing. I guess it might be the problem with the syntax in the 4th line of code — sound.src=“prop.sound”;
Can Some one help me please…
const TestSound = (prop) => {
const playSound=(prop) => {
let sound = new Audio();
sound.src = "prop.sound";
sound.play();
}
return(
<a href="#" onClick={playSound} > <h2>{prop.title}</h2></a>
)
}
export default TestSound;