1 00:00:00,680 --> 00:00:05,660 As we've discussed many times throughout this course, a component is a function or a class that can 2 00:00:05,660 --> 00:00:09,530 produce some H.T. Amelda showed to the user or handle user feedback. 3 00:00:10,070 --> 00:00:14,480 At this point, we've really only been taking a look at function components moving forward. 4 00:00:14,570 --> 00:00:17,630 We're gonna start to take a look at Class-Based components as well. 5 00:00:18,260 --> 00:00:22,310 I want to first begin this entire section with a quick discussion on some of the differences between 6 00:00:22,310 --> 00:00:24,470 class components and function components. 7 00:00:24,830 --> 00:00:29,180 We're also gonna have a short discussion on something in the world of react called the Hooke's system. 8 00:00:29,480 --> 00:00:30,320 So let's get to it. 9 00:00:31,600 --> 00:00:36,790 All right, so first off, quick diagram here to help you understand how to react, Eco-System used 10 00:00:36,790 --> 00:00:37,210 to be. 11 00:00:37,630 --> 00:00:41,020 This diagram right here is react in the past, in many years ago. 12 00:00:41,860 --> 00:00:47,410 It used to be that with react, we made use of functional components only for producing content to show 13 00:00:47,410 --> 00:00:47,980 to the user. 14 00:00:48,340 --> 00:00:50,650 And that's really what I've been telling you throughout this course so far. 15 00:00:51,250 --> 00:00:53,740 And it used to be that we made use of class components. 16 00:00:53,830 --> 00:00:58,780 Anytime that we wanted to make use of something called the Lifecycle Method System, which we'll discuss 17 00:00:58,810 --> 00:01:04,090 in due time and any anytime we want to use the state system, which is how we somehow update content 18 00:01:04,300 --> 00:01:05,290 displayed to the user. 19 00:01:05,950 --> 00:01:07,990 Again, this is how everything used to be. 20 00:01:08,710 --> 00:01:13,060 Most notable difference between class components and functional components is that functional components 21 00:01:13,060 --> 00:01:15,220 were much more restricted in nature. 22 00:01:15,640 --> 00:01:19,660 They did not have access to that lifecycle method system or the state system. 23 00:01:20,050 --> 00:01:23,980 And that meant that we only used functional components to show content to our users. 24 00:01:24,220 --> 00:01:24,760 That's it. 25 00:01:25,510 --> 00:01:31,450 But now it's much later in the development cycle of react and functional components have gotten a little 26 00:01:31,450 --> 00:01:33,190 bit more fancy over time. 27 00:01:34,300 --> 00:01:38,210 And that is most notably through the introduction of something called the Hooke's system. 28 00:01:38,810 --> 00:01:42,830 This diagram right here is how react is today in the present time. 29 00:01:44,250 --> 00:01:49,920 With this system, the REACT team have given many more capabilities to function components and through 30 00:01:49,920 --> 00:01:55,410 the use of this whole system, function components can now execute code at specific points in time, 31 00:01:55,710 --> 00:02:00,060 which is roughly equivalent to the lifecycle method system tied to class components. 32 00:02:00,900 --> 00:02:04,260 In addition, function components can make use of the state system. 33 00:02:05,560 --> 00:02:12,700 So really today with react function components are largely now much more similar to class components 34 00:02:12,700 --> 00:02:13,440 than they used to be. 35 00:02:14,510 --> 00:02:16,160 That really starts to beg the question. 36 00:02:16,250 --> 00:02:20,600 This is the first question that starts to come up if class components and function components today 37 00:02:20,660 --> 00:02:24,230 are more or less the same thing or have the same capabilities. 38 00:02:24,620 --> 00:02:27,500 Which one should we actually use and which one should we learn? 39 00:02:28,070 --> 00:02:30,770 Well, there's a couple of different ways to approach this question. 40 00:02:31,550 --> 00:02:36,170 The first thing I want you to understand is that for any companies that are maintaining or building 41 00:02:36,200 --> 00:02:38,490 established projects or products. 42 00:02:38,830 --> 00:02:42,350 So in other words, if there's some company out there that's been working the same react up for a number 43 00:02:42,350 --> 00:02:47,990 of years, chances are they are making use of class based components because that used to be the way 44 00:02:48,080 --> 00:02:52,280 and the only way that we could work with the state system and lifecycle methods and so on. 45 00:02:53,810 --> 00:02:58,880 Any company that is working on a newer project might be making use of either Class-Based components 46 00:02:59,030 --> 00:03:00,710 or function based components. 47 00:03:01,370 --> 00:03:06,800 So the other day, the real thing you need to understand here is that you have to understand both class 48 00:03:06,800 --> 00:03:09,710 components and function components with the hook system. 49 00:03:10,100 --> 00:03:10,870 You have to know both. 50 00:03:10,970 --> 00:03:14,030 You can't just learn one and say, oh, I understand react. 51 00:03:14,180 --> 00:03:16,820 You really have to understand both different approaches. 52 00:03:17,500 --> 00:03:19,190 Now, I can actually show this to you very easily. 53 00:03:19,990 --> 00:03:22,880 The second tab right here, I've got a Web page open. 54 00:03:23,920 --> 00:03:27,460 This is a dashboard at stripe, dot com stripe. 55 00:03:27,570 --> 00:03:29,830 If you've never heard of it is a payment processor. 56 00:03:29,890 --> 00:03:31,930 So they handle credit card payments and so on. 57 00:03:32,620 --> 00:03:36,910 Stripe is a company currently worth thirty six billion dollars. 58 00:03:37,390 --> 00:03:40,630 This is a company with a tremendous amount of money to throw around. 59 00:03:41,020 --> 00:03:44,020 They have a tremendous amount of engineering resources. 60 00:03:44,430 --> 00:03:48,670 So without a doubt, if they wanted to, they could rebuild this application they see on the screen, 61 00:03:48,730 --> 00:03:51,820 which is made with react using only function components. 62 00:03:52,220 --> 00:03:53,530 Let me show you something really interesting. 63 00:03:54,490 --> 00:03:57,240 Over here on the right hand side, I've got a little menu open. 64 00:03:57,730 --> 00:04:02,320 This is a little menu that's showing a list of all the different function components that are currently 65 00:04:02,320 --> 00:04:03,700 being displayed on the page. 66 00:04:04,150 --> 00:04:07,180 So every single item that you see here is a function component. 67 00:04:07,870 --> 00:04:12,700 I can scroll through this and you'll see very quickly that there are hundreds of different components 68 00:04:12,730 --> 00:04:13,330 in use. 69 00:04:14,170 --> 00:04:16,300 Some of these don't really have any job. 70 00:04:16,330 --> 00:04:18,550 But to show some content to a user. 71 00:04:18,670 --> 00:04:20,920 So, for example, maybe this box component right here. 72 00:04:21,220 --> 00:04:23,650 Well, it's probably meant to just contain some other element. 73 00:04:24,010 --> 00:04:27,070 There's probably not any fancy functionality tied to this component. 74 00:04:28,390 --> 00:04:31,660 I can also filter in this list by class components. 75 00:04:33,520 --> 00:04:38,890 And when I do, you're going to see once again that there are several hundred class components in use 76 00:04:38,920 --> 00:04:39,850 on this page as well. 77 00:04:40,750 --> 00:04:47,860 So long story short, this is a application made by a 36 billion dollar company and they still use both 78 00:04:47,860 --> 00:04:50,230 class components and function components. 79 00:04:50,890 --> 00:04:54,370 This really should be proof to you that you really have to understand both approaches. 80 00:04:55,240 --> 00:04:56,530 Now, why is this all so relevant? 81 00:04:56,740 --> 00:04:59,590 Well, here's what it really comes down to in the context of this course. 82 00:05:00,850 --> 00:05:06,010 If you just try to jump in and learn the hook system with function components, it ends up being really 83 00:05:06,010 --> 00:05:07,270 hard and really challenging. 84 00:05:07,810 --> 00:05:12,880 And I should know I've made a react course before where I just showed, hey, let's just learn function 85 00:05:12,880 --> 00:05:15,550 components with the hook system and then go on to learn redux. 86 00:05:15,820 --> 00:05:20,530 And I found that people had a really tough time understanding Hooke's when it is introduced right from 87 00:05:20,530 --> 00:05:20,980 the get go. 88 00:05:21,730 --> 00:05:27,340 What is much easier to learn and understand is to first understand the state stuff in lifecycle methods 89 00:05:27,490 --> 00:05:33,630 tied to class components, and then to take that knowledge and learn more about hooks and then go into 90 00:05:33,640 --> 00:05:34,750 the world of redux. 91 00:05:35,200 --> 00:05:36,610 And that's what we're going to do in this course. 92 00:05:37,020 --> 00:05:40,810 So in the coming sections, you're going to see a bunch of videos, all about class components. 93 00:05:41,170 --> 00:05:44,300 We're going to learn a lot about the state system and react in lifecycle methods. 94 00:05:44,830 --> 00:05:49,450 And then after that, we're going to take all that knowledge and apply it to learn the Hooke's system 95 00:05:49,510 --> 00:05:50,280 in react. 96 00:05:50,450 --> 00:05:53,530 And that's gonna make this entire process a lot easier on you. 97 00:05:53,800 --> 00:05:58,300 And to be honest, it's actually can go a lot faster because it's gonna be so much easier to understand. 98 00:05:59,170 --> 00:05:59,440 All right. 99 00:05:59,540 --> 00:06:01,510 Now, we've got a good idea of what we're gonna do. 100 00:06:01,600 --> 00:06:03,280 Let's get to it in the coming videos.