Help needed in passing the last test of drum machine!

Help needed in passing the last test of drum machine!
0

#1

I am having trouble in last test where a string attached to the key is displayed. Please check my code and help!


#2

You’re using #display as a wrapper for the drum pads and it should be used to display the name of the pad being trigger instead.


#3

I did the correction but its still not passing, Please help!


#4

Line 54: this.props.handleDisplay(this.props.id).

Are you sure you’re passing handleDisplay and id as props? You should change that “id” for “audioID” and build the method you want to pass as “handleDisplay”.


#5

i renamed it to audioID but still I am not getting it. Could you please help me with a solution and then explain it. Highly appreciated.


#6

I told you what to do :slight_smile: You were going in the right direction.

You need to update the #display with the audio name. I would create a new state for that, create a method that changes the value of that state when a pad is triggered and pass it along with props to the child component where the pads are rendered.

Get back to this project after some rest and try again. You’ll see you can complete it following this instructions.

Good luck!


#7

All right buddy, will let you know.


#8

I tried doing what you said, please help, I am still not able to clear it!


#9

I’ve reviewed your code again. You need to move the state from the DrumButton component to the App component. Then, in the playSound function, inside App component, add this.setState({ display: audioID }). Then, clean up your code because there are some useless methods and properties.


#10

Thanks a ton mate, it worked, finally passing all 8 tests. Moving on to Calc project