GoConqr has a new look! Let us know what you think.

Module 26 of 28 · Media

Changing parent's state through Form

Kostas Diakogiannis

Changing parent's state through Form

Changing parent's state through Form

Now we will give the <FormInput /> component the power to change the state by passing the updateValue function to this component as a prop!

At the same time we will use the current state of the input value every time to update the depicted message! We will use again the props here in order to achieve this effect.

It is extremely important here to bind the function as it is shown to the second image down. That means that the function will be executed inside the FormInput component but the state is going to be <App /> component state! So in other words, we change App’s state from the FormInput component.

Then we use the passed prop function every time the field is updated and the data is changed!

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?