How about if we also have a button that can also change the name of Ellen Smith.
We need to go to the card and type on change name.
This is any name that you want and then we buy the functions that change the name handler to on changed
name.
There's nothing happen on the screen but when you take a look at the object you will see that there
is a function here.
There is a on changing name under this object.
And also there is something that we need to change is we can use the leaf under the paragraph.
So we have to go to the top component and change it to Dave.
Now the era has gone down.
Here we can create another button that used it to change the name
now at this button.
We can type on Craig and then we buy the pop stock
on changed name which is the name defined in here.
So let's try the result when we click the change name.
It will also change to Michael Chan.
But how about if you want to make this change name and this change name something different.
Such as if I pass here you change to Michael Tran.
And then if we pressed a button on the top we will change to John Doe then we have to make some changes
on the functions.
So instead of hot cooked them Michael Chan here we have to create a argument such that it's time we
passed the name it will set different name so we can now go to the change handler and past the name
that we want.
For example this is John Doe and this is Ellen Smith.
This is Michael Tran.
Now if we take a look this will have a era that there is too many.
We render and this become an infinite loop.
This is because when we take a break here it will become a Q even we do not click on the button.
So the pages will already already secured a changed name handler.
So it will keep changing the name so it becomes an infinite loop.
So in order to stop this loop we have to create a will function here.
So now this will become it only return change when the button is Craig.
So now the error has gone and we can try the button when we take the top button it will change to a
John Doe.
And if we take that change name button inside a top it will become my code change.