Question/help with Drum machine react

hey! so I just got to react and I want to solidify my knowledge with the fcc projects! I know it may not have a lot of best practices or be pretty code but I am a learning!
practice makes perfect.

I am a little bamboozled with a bug, and some behavior, at first i added an early return to my function handleSound with a power state, but i noticed the function was ignoring it and not returning early when i used the keyboard but it did with mouse click i mostly want to understand what it going on so i can learn and develop please!

here is a link to the code sandbox

Maybe you have fixed this? Because I can’t seem to trigger a bug with either the mouse or keyboard. Or perhaps I don’t understand exactly what the but is? Can you go into a little more detail if it is still an issue.

this is a boiled down version of the bug!
i have the almost finished project here
on here, if you turn off the app. and then move the volume you are still able to hear sound with the keyboard. (it needs to be in that order)
i just tought the previous example may be simpler to see. thank you for the help

solved the issue, with help!
i was missing the clean up in the if statement of the use effect
return ()=>window.document.removeEventListener(“keydown”, handleEvent);

thank you for taking a look at it and for your time

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.