Help needed in passing the last test of drum machine!

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

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.

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

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”.

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.

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!

All right buddy, will let you know.

1 Like

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

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.

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

1 Like