I’m currently doing the Drum Machine project (link: https://codepen.io/Crimson_Macaw/pen/NOmaXY?editors=1111) and I’ve created two components called App and DrumApp. App is the parent of DrumApp. What I’m trying to do is have the “handleClick” function from inside DrumApp access one of the state values from inside App.
Specifically, I want the “handleClick” function to check if state.power inside of App is false, and if it is, disable the “handleClick” function. I’ve tried accessing the state.power value from inside DrumApp but I can’t seem to do it. Nor can I figure out how I could rewrite the handleClick function and have it do the same job from inside of the App component directly.
I’d appreciate any and all help on this, because it ties in to another issue I have which is how to get the drumpad letters to switch between playing the “drums” audio and the “sounds” audio whenever I switch between the two on the left hand side of the app.