4.7 update status that depends on letat preceden
So to start this course
What you’re going to do is very simple.
We’ll put this in const and we’ll call our state that only once when passing the object in
as value and it’s important not a chain or a number or anything like that but
an object
we’ll write down UseState we’ll put parentheses
and in its parentheses you put brackets of course in this object
you can now group to free states
you could have a title key maybe
a title key entered
and contains an empty string at the start
so inside we’ll put title
from the inside we’ll put entered title
like this and we can legally do it with
an amount is the last we will add the date
then in front of the UseState how we will add
a conste crochet User input =UseState voilà
then interior with the UserInput you add
setUserInput is below the const title
changeHandler here you will put it in comment and we’ll call it setUserInput right here but at the inside here this
that we’re going to do we’re going to put like before
bracket and we’ll put entered title put the title and we’ll add an event like
at the last price
but target and value
but this is now the trickiest part
where you also make sure the other two data does not get lost
add three small points here
and what I’m gonna do is I’m gonna write input and therefore if you have
never seen this Syntax
it just takes an object extracted all the pairs and this extracts all the value key pairs then we
can always overwrite the value key pairs
like this between title and doing like this
we’ll make sure the others aren’t
are also part of the new state
so what we just did here
you can do it in three states like this
you have to change here the add you part Amount
is here by date
so you can choose the code you prefer
even if this code you are not yet perfect we
meet up for the next class.