In the last exercise, you defined a function in Parent that can change Parent‘s state.

Parent must pass this function down to Child, so that Child can use it in an event listener on the dropdown menu.



We now need to make sure that the .changeName() method will always refer to the instance of Parent, even when we pass it down to Child to use.

In the constructor method of Parent, bind this.changeName to the current value of this and store it in this.changeName.


Pass .changeName() down to Child!

In Parent.js, inside of Parent‘s render function, add a second attribute to <Child />. Give this attribute a name of onChange, and a value of the changeName method.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?