React JS - prop

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;

onClick={this.playSound} or even onClick={ () => this.playSound}

Thanks for the info :+1:
I am very new here in free code camp forum.

Thanks for answering, but I cant solve with this solution.
Is line four is correct, I think prop might be used with some other syntax - not like “prop.sound” (as above)…Can you please figure out the mistake

I made it right :slightly_smiling_face:
it is -

sound.src = prop.sound;
1 Like