Drum Machine playing same sound for all buttons

Can anybody tell me where am I going wrong?

Drum machine is playing same sound for all buttons.

https://codepen.io/agrawalparul2/pen/LYbaGqJ

You create only one ref, then loop over the buttons and override that value each time. That’s why all buttons have the sound of the last button.
You can either create multiple refs or maybe use an array: createRef([])

Thank you. But I still couldn’t figure it out.

Your codepen doesn’t look like you’ve tried anything, what’s your updated code?

I tried creating array for ref but then everything stopped working. No buttons were responding, so I changed the code.