1 00:00:00,240 --> 00:00:07,890 We already discussed an about use effect and we also know that there is a clean up when the component 2 00:00:07,890 --> 00:00:12,750 is monitored but sometimes not everything like this another. 3 00:00:13,300 --> 00:00:16,630 Yeah you say from a certain cold we move the listener. 4 00:00:16,670 --> 00:00:18,150 And in this case yes. 5 00:00:18,180 --> 00:00:27,600 Where can apps do to use the Web can however deal with these problems and to make a example more clear. 6 00:00:27,600 --> 00:00:32,310 We are going to add a header to this fingers to example 7 00:00:38,950 --> 00:00:41,460 in order to create a b among component. 8 00:00:41,470 --> 00:00:44,530 We have to create a component. 9 00:00:45,070 --> 00:00:56,210 So we go to create a new folder called components and inside the components we create a component dotty 10 00:00:56,290 --> 00:00:56,770 as 11 00:01:00,500 --> 00:01:02,360 an inside the component. 12 00:01:02,370 --> 00:01:03,940 We will use. 13 00:01:04,830 --> 00:01:05,480 You will stay 14 00:01:12,650 --> 00:01:16,740 and we create a constant command and effect kind 15 00:01:20,380 --> 00:01:31,600 equal to a use day and then we create a fake fetch from the Jones that pretend is fetching a new rally 16 00:01:31,600 --> 00:01:33,220 or fund a we both server 17 00:01:36,240 --> 00:01:40,300 and every two seconds it will increase the Congress to buy one 18 00:01:46,780 --> 00:01:54,610 and we display the value inside the header and then we also create a button to trigger the effect fetch 19 00:01:54,610 --> 00:01:55,900 functions. 20 00:01:56,200 --> 00:02:02,350 Then we back to the app J S and import the component from components. 21 00:02:02,830 --> 00:02:07,720 And then we are going to demonstrate that a mounting component problems. 22 00:02:07,720 --> 00:02:15,930 So we create a header named as a main component and we are going to import the component here. 23 00:02:15,940 --> 00:02:23,870 Now we also have to create a button to trigger the toggle showing i.e. functions. 24 00:02:37,850 --> 00:02:45,200 So now when you click on the toggle component it will hide the component and when you click the effect 25 00:02:45,230 --> 00:02:49,220 fetch it will still can at the White House by one. 26 00:02:49,250 --> 00:02:55,970 But when you toggle but when you click the effect fetch button and then you toggle the component it 27 00:02:55,970 --> 00:03:01,970 will destroy it an error because the components already are monitored but we are going to perform the 28 00:03:01,970 --> 00:03:02,770 update. 29 00:03:02,780 --> 00:03:09,960 So what can we do is to go to the component and in order to check the component is a mindset. 30 00:03:09,980 --> 00:03:14,710 We have to use to use if that and then we create a component where 31 00:03:30,870 --> 00:03:35,490 and then add a cleanup part we change the component where to boss. 32 00:03:35,490 --> 00:03:37,710 We also need to import the use of where. 33 00:03:38,010 --> 00:03:40,940 So now we have these components top for orange. 34 00:03:40,950 --> 00:03:47,400 So now we have the components RAF block curve and we can use these to check whether it is a monitor. 35 00:03:47,550 --> 00:03:54,980 So we will only go 2 seconds only when the component with Dr. orange is equal to true. 36 00:03:55,050 --> 00:03:58,170 Otherwise we will not update it can rarely use. 37 00:03:58,170 --> 00:04:00,150 So now we can try again. 38 00:04:00,150 --> 00:04:09,420 Now if we were not so the areas even where we clicked on effect fetch to make it more clear we can create 39 00:04:09,420 --> 00:04:14,040 a console not to let us know that the function is really executed. 40 00:04:14,130 --> 00:04:17,410 So now we kick on the fact fashion and talk with the components. 41 00:04:17,490 --> 00:04:23,190 You will not show the arrows but if the component is still here it will update you radically.