O GoConqr está de visual novo! Conte para nós o que você achou.

Módulo 26 de 28 · Mídia

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!

Instruções

Para avançar no curso, envie uma tentativa deste quiz. Você pode enviá-la depois da última pergunta.

Ir para o módulo escolhido

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?