¡GoConqr estrena diseño! Cuéntanos qué te parece.

Módulo 26 de 28 · Multimedia

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!

Instrucciones

Para avanzar en el curso, envía un intento de este test. Puedes enviarlo después de la última pregunta.

Ir al módulo elegido

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?