Drum machine challenge

here is my code at the moment:


What is the problem you’d say? I am a bit confused on accessing the data I set up in the child component from a function I set up in the parent component. I know react has it own way of listening for events but the one I know does not seem to cover the current topic. I have made research and all the docs were pointing to is input from forms. I can call the function I setup in the parent from the child but the confusing thing is how to access data which resides as state in the child component. I also need advise on the best event function to use in this project is it onClick or onKeyPress? I wont mind reading docs that deals with the issues I raised or particular pointers to my challenge.

onClick is the way to go. You want to bind that event listener to all the necessary keys.

I am not sure how you structured your setup but you probably want to call a callback function and pass in an event value to your parent.

Hi all I am still having issues with getting my audio to play in this project: https://codepen.io/highness/pen/xmMMoG?editors=0011 I keep getting this error on the console TypeError: _this.audio.play is not a function at App._this.handleClick handleClick is to check if the drum-pads were clicked and if it was clicked the Refs will get the audio file embedded in drum-pads I have been scouring the internet (and avoiding spoilers as well) on how to get it to work. Help is required please.