Drum Machine Test 7 is failing

It appears related to React 18. More info.


In your code, I can fix it using flushSync

import { flushSync } from 'react-dom';

const playAudioClips = () => {
  flushSync(() => {
    setDisplayDescription(clip.displayDescription);
  });
  let newClip = document.getElementById(clip.label);
  newClip.play();
};

As an aside, I would suggest you move the logic out of the button component and into App. It really doesn’t belong there, especially not the event listener setup.