title: TypeError: current.play is not a function in React
body: <p>I am trying to play the audio onClick in react, however I got the error, I did check the ref,
  it is the audio element, I don't know what's wrong, any help will be much appreciated.</p>
  <pre><code>import React, { useRef } from &quot;react&quot;;
  
  
  function App() {
    const audio = useRef(null);
    const playAudio = () =&gt; {
      let current = audio;
      console.log(current);
      current.play();
    };
    return (
      &lt;div id=&quot;drum-machine&quot;&gt;
        &lt;div id=&quot;display&quot; onClick={playAudio}&gt;
          display
        &lt;/div&gt;
        &lt;div&gt;
          
          &lt;audio
            controls
            src=&quot;/media/cc0-audio/t-rex-roar.mp3&quot;
            ref={audio}
            autoPlay
          &gt;
            Your browser does not support the
            &lt;code&gt;audio&lt;/code&gt; element.
          &lt;/audio&gt;
        &lt;/div&gt;
        
      &lt;/div&gt;
    );
  }
  
  export default App;
  </code></pre>