1 00:00:00,300 --> 00:00:07,010 How about if we also have a button that can also change the name of Ellen Smith. 2 00:00:07,290 --> 00:00:10,680 We need to go to the card and type on change name. 3 00:00:10,680 --> 00:00:16,950 This is any name that you want and then we buy the functions that change the name handler to on changed 4 00:00:16,950 --> 00:00:19,290 name. 5 00:00:19,440 --> 00:00:24,870 There's nothing happen on the screen but when you take a look at the object you will see that there 6 00:00:24,870 --> 00:00:27,240 is a function here. 7 00:00:27,290 --> 00:00:29,910 There is a on changing name under this object. 8 00:00:31,080 --> 00:00:36,920 And also there is something that we need to change is we can use the leaf under the paragraph. 9 00:00:37,110 --> 00:00:49,500 So we have to go to the top component and change it to Dave. 10 00:00:49,650 --> 00:00:52,040 Now the era has gone down. 11 00:00:52,080 --> 00:00:56,820 Here we can create another button that used it to change the name 12 00:01:06,990 --> 00:01:08,030 now at this button. 13 00:01:08,040 --> 00:01:14,190 We can type on Craig and then we buy the pop stock 14 00:01:17,180 --> 00:01:22,610 on changed name which is the name defined in here. 15 00:01:24,230 --> 00:01:29,780 So let's try the result when we click the change name. 16 00:01:29,780 --> 00:01:32,090 It will also change to Michael Chan. 17 00:01:32,810 --> 00:01:38,360 But how about if you want to make this change name and this change name something different. 18 00:01:38,360 --> 00:01:42,440 Such as if I pass here you change to Michael Tran. 19 00:01:42,470 --> 00:01:50,390 And then if we pressed a button on the top we will change to John Doe then we have to make some changes 20 00:01:50,420 --> 00:01:52,250 on the functions. 21 00:01:52,250 --> 00:01:59,870 So instead of hot cooked them Michael Chan here we have to create a argument such that it's time we 22 00:01:59,870 --> 00:02:08,520 passed the name it will set different name so we can now go to the change handler and past the name 23 00:02:08,520 --> 00:02:09,590 that we want. 24 00:02:09,590 --> 00:02:18,470 For example this is John Doe and this is Ellen Smith. 25 00:02:18,470 --> 00:02:27,510 This is Michael Tran. 26 00:02:27,640 --> 00:02:32,600 Now if we take a look this will have a era that there is too many. 27 00:02:32,600 --> 00:02:36,220 We render and this become an infinite loop. 28 00:02:36,220 --> 00:02:43,610 This is because when we take a break here it will become a Q even we do not click on the button. 29 00:02:44,290 --> 00:02:49,980 So the pages will already already secured a changed name handler. 30 00:02:50,020 --> 00:02:54,440 So it will keep changing the name so it becomes an infinite loop. 31 00:02:54,460 --> 00:03:03,210 So in order to stop this loop we have to create a will function here. 32 00:03:03,310 --> 00:03:10,730 So now this will become it only return change when the button is Craig. 33 00:03:10,810 --> 00:03:18,520 So now the error has gone and we can try the button when we take the top button it will change to a 34 00:03:18,520 --> 00:03:19,680 John Doe. 35 00:03:20,080 --> 00:03:26,650 And if we take that change name button inside a top it will become my code change.