title: Unable to pause audio in Reactjs
body: <p>I've followed the other posts that have asked similar questions, but they have not provided a solution.</p>
  <p>I'm not able to pause audio in my React Hook.</p>
  <p>This is my react hook:</p>
  <pre><code>import React, { useState } from &quot;react&quot;;
  
  export default (App = props =&gt; {
    const [audioStatus, changeAudioStatus] = useState(false);
    const audio = new Audio(
      &quot;https://mcdn.podbean.com/mf/web/xm5ngf/The_Challenge_Chronicles_-_Episode_48_7ys6e.mp3&quot;
    );
    audio.load();
  
    const startAudio = () =&gt; {
      audio.play();
  
      changeAudioStatus(true);
    };
  
    const pauseAudio = () =&gt; {
      console.log(&quot;here&quot;);
      audio.pause();
      changeAudioStatus(false);
    };
  
    return (
      &lt;&gt;
        {audioStatus ? (
          &lt;button onClick={pauseAudio}&gt;pause&lt;/button&gt;
        ) : (
          &lt;button onClick={startAudio}&gt;start&lt;/button&gt;
        )}
      &lt;/&gt;
    );
  </code></pre>
  <p>I've also created a sandbox: <a href="https://codesandbox.io/s/great-gagarin-v0vi1" rel="nofollow noreferrer">https://codesandbox.io/s/great-gagarin-v0vi1</a></p>