If I want to make a functional component that will contain a form ,to login for example, and I want to contain the state in App component and Login will be its child, can I mutate the state in App using the form in Login child?
Yes. Pass two props an object data
and a method onChange
to Login
from App
.
data
will set the values for the form in Login
.
Fire onChange
with updated form values if there is any change in Login
form.
Handle it in App
and update its state which will then flow down to Login
as data
.