In this part we are going to Colorado State and Aaron into objects to convert them into an object.
We'll make the programming more flexible.
And in this part we are going to create the state and action not just control one controller but also
can increment and decrement and we have different values of just one.
So for us we go to the contact dot J S and we go to the initial state and then you off just have to
see Rocío.
We are going to create to conquer.
So one e conquer one
and the other is tattoo and we can said they have different initial state.
I think some of you may already know that we have to change something.
We have changed the day into a counter one.
So in order to make the Web site again we have to go to the render.
This does not count.
Instead we have to counter one because we already said that in the last letter that this is actually
a state.
So the state have kind to one and contact two now.
So we have to at all county one.
And now we can just use state plus one because there are two counties now.
So we have to use dispatch operator that we already teach in the previous letter which is we turn the
state.
We make a copy and then we specify.
This is the Tonto one values the state of Tonto.
One
plus one we will become the new Tonto one value and the same for the Tillman.
But this time is minus one and for the on Craig instead of using dispatch increment we are going to
also change states to object.
We create type increment and also this will become typed decrement and this will also become typed.
We said now instead of just action not only to check the type.
So this is action dog type.
Now you can track again to see whether it's still working.
So you can see it is still work fine.
Now we are going to create another conference.
So we have to use a new component batch from the we had strap and in here we are going to create another
button groups to show the content where you
now we're deprecate this one and this one showed a counter one
and this one so the counter to an EOD where the use of the Condor.
Oh this is tank top counter one and this become kind of kinder to now we delete this original Dave and
we also add a paragraph.
Now we can see the video of two contests and we can do editing and decreasing the numbers of count of
one.
Now we add a new groups to control the content too.
I think we do not need duplicate reset button.
So we just leave one reset button here.
And I was I or the button groups
so to control the content to we have to add two more cases we use increment two to control the content
two and a decrement to control the minus function of the content too.
So here we also need to change this into content too.
And also the function here will become increment 2 and decrement 2.
So maybe we
make the button more specific.
Now you see there are new rules of button which can control the value of content too.
And the content one still working when we pass we reset both of them back to the initial values.
I also just mentioned that converting the essence into object is to make the program more flexible.
Now we are going to show you why this is more flexible.
Now with liberty and new rows of buttons.
Now we are not just increasing the value one by one.
Instead we are going to increase the value by five.
So the original button still adding the value by 1 and decreasing the value by 1.
So how can we use the East Palo.
We have to go to the actions and instead of just using the one we have to replace it to Ashton top pay
low
to make it more clear we also add five as the name of the buttons.
Now when we click on the increment five you'll see the count how one will increase by five and also
decrease by five using the original button we'll increase one by one and pressing the reset button is
two you can convert two contests to initial state.