You don’t because this code should be entirely inside of JS script, not HTML code In other words you can get rid of the HTML part with audio element. Just import the audio file, create a variable at some visible place, and for example if you have a function that is triggered at the click of a button, you can add ring.play();
For example, imagine that you have a button in your JSX part, and when you click the button doSomething() function is called.
<button onClick={this.doSomething}>
Then, each time you click that button component looks up into the available functions and doSomething is called. Remember about using arrow functions otherwise, you will have to bind them.
Inside of the function it will look somehow like this
doSomething = () => {
const ring = new Audio(Ring);
ring.play();
}
That is all! Each time you click the button now => doSomething is called, which is a variable with a function attached to it => new variable with audio file is created => then we call play() function on it.
User Story #26: When a countdown reaches zero (NOTE: timer MUST reach 00:00), a sound indicating that time is up should play. This should utilize an HTML5 audio tag and have a corresponding id="beep" .
User Story #27: The audio element with id="beep" must be 1 second or longer.
User Story #28: The audio element with id of beep must stop playing and be rewound to the beginning when the element with the id of reset is clicked.
My bad in this case you should use the following way
inside of the constructor this.audioRef = React.createRef(); and attach the audio HTML element like that