Drum Machine using React: Click event problems

My project:

https://codesandbox.io/s/9448mn30ry
(much of the code for the app is in the ‘AudioButton.js’ file)

Hi all!
I’m stuck on a problem I’m having with my react Drum Machine project; I can click a button and have a sound play, but if I click another button while the first sound plays, nothing fires. I can click a number of times with the result being nothing. How do I fix this? Or even, what should I look up to address this problem?

 togglePlay = () => {
    this.setState({ play: !this.state.play }, () => {
      this.state.play && this.audio.play();
    });
  };

The this.state.play toggles from true to false on each click so it will play on every other click.

1 Like

Ah! LOL :rofl::joy::rofl:

Thanks so much!