SetTimout trick

Why does this trick using setTimout (copied from someone) work? Without it, the .play method is called before the .load method is fully executed. My code works great, just want to understand why.

function App() {
  const [clicked, setClicked] = useState("");
  var [source, setSource] = useState("");

let emptyRef = useRef();

function playAudioChoke(e) {
setSource("https://freecodecampassets.s3.us-east-2.amazonaws.com/drum+machine+wavs/all_ganjaman_let_loose.wav")

 setTimeout(function() {
      e.load();
      e.play();
    }, 0);
  }

playAudioChoke(emptyRef)


return (    <audio src={source} ref={emptyRef}></audio> )

export default App;