Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,900 --> 00:00:07,260
So now that we know why we need a JavaScript framework in the first place, let's start by learning
2
00:00:07,260 --> 00:00:09,990
about the most popular framework out there.
3
00:00:10,020 --> 00:00:11,130
React.
4
00:00:11,430 --> 00:00:18,590
So in this lecture we will get a high level overview of what React actually is and how it works.
5
00:00:18,600 --> 00:00:22,710
So it's going to be a full packed but super interesting lecture.
6
00:00:22,710 --> 00:00:24,900
So let's quickly get started.
7
00:00:26,530 --> 00:00:33,670
So, according to the official React documentation, React is a JavaScript library for building user
8
00:00:33,670 --> 00:00:34,750
interfaces.
9
00:00:34,900 --> 00:00:39,460
Now that's something, but it really isn't that helpful, is it?
10
00:00:39,490 --> 00:00:46,750
So let's extend this definition by a bit so that it becomes more helpful or should I say a little bit
11
00:00:46,750 --> 00:00:49,300
more crazy like this.
12
00:00:49,510 --> 00:00:57,040
So now in this slightly modified definition, React is an extremely popular, declarative, component
13
00:00:57,040 --> 00:01:04,180
based, state driven JavaScript library for building user interfaces created by Facebook.
14
00:01:04,270 --> 00:01:11,920
And this is actually a lot more helpful because now we can deconstruct this definition and learn about
15
00:01:11,920 --> 00:01:14,620
what React actually is step by step.
16
00:01:15,400 --> 00:01:23,530
So starting with component based design, React is all about components such as buttons, input fields,
17
00:01:23,530 --> 00:01:25,780
search bars and so on.
18
00:01:26,050 --> 00:01:31,310
So components are the building blocks of user interfaces in React.
19
00:01:31,330 --> 00:01:38,160
And in fact, basically all React does is to take components and draw them on a web page.
20
00:01:38,170 --> 00:01:39,280
That's it.
21
00:01:39,310 --> 00:01:47,200
And so we build complex UIs in React by building multiple components and then combining these components
22
00:01:47,200 --> 00:01:52,930
like Lego pieces, for example, to create a complex application like Airbnb.
23
00:01:53,560 --> 00:02:00,460
So here we have exactly the same components that we saw earlier, but all combined into a complex UI.
24
00:02:00,490 --> 00:02:05,710
So the nav bar, the search bar, the results panel and the map.
25
00:02:05,830 --> 00:02:09,740
Now another thing that we do with components is to reuse them.
26
00:02:09,760 --> 00:02:15,350
For example, here in the results panel, there are multiple listings that look quite similar.
27
00:02:15,350 --> 00:02:21,590
And so we can create a listing component and then reuse it three times here, simply adjusting the data
28
00:02:21,620 --> 00:02:22,400
a little bit.
29
00:02:23,480 --> 00:02:31,040
Now since we built complex UIs by combining multiple components, each component must have all the information
30
00:02:31,040 --> 00:02:33,470
about what it looks like, right?
31
00:02:33,650 --> 00:02:40,700
So in order to describe what each component looks like and how it works, we use a special declarative
32
00:02:40,700 --> 00:02:42,290
syntax called JSX.
33
00:02:43,010 --> 00:02:50,390
And declarative simply means that we tell React what a component and ultimately the entire UI should
34
00:02:50,390 --> 00:02:53,210
look like based on the current state.
35
00:02:53,240 --> 00:03:00,440
So React is basically a huge abstraction away from the Dom so that we never have to work with the Dom
36
00:03:00,440 --> 00:03:03,810
directly as we would with vanilla JavaScript.
37
00:03:03,830 --> 00:03:10,210
So we simply tell react what we want to happen when some data changes, but not how to do it.
38
00:03:10,220 --> 00:03:12,740
And again, we do that using JSX.
39
00:03:13,430 --> 00:03:22,310
So JSX is basically a syntax that combines parts of HTML, CSS, JavaScript, and it even allows us
40
00:03:22,310 --> 00:03:25,080
to reference other React components.
41
00:03:25,080 --> 00:03:32,220
And the declarative nature of React is an essential concept that of course we will really dive into
42
00:03:32,220 --> 00:03:32,940
later.
43
00:03:33,980 --> 00:03:40,130
But now you might wonder if we never touch the Dom, then how does React update the UI?
44
00:03:40,340 --> 00:03:44,180
Well, that's where the concept of state comes into play.
45
00:03:44,480 --> 00:03:50,770
So remember that the main goal of React is to always keep the UI in sync with data.
46
00:03:50,780 --> 00:03:54,440
And from now on, let's actually call that data state.
47
00:03:54,470 --> 00:03:57,920
For example, an array of apartments on Airbnb.
48
00:03:58,400 --> 00:04:05,510
So based on our initial state, React will render a user interface using the components that we wrote
49
00:04:05,510 --> 00:04:06,380
using JSX.
50
00:04:07,070 --> 00:04:12,110
Then, based on some event like a button click, the state might change.
51
00:04:12,110 --> 00:04:16,930
For example, more data about apartments might be loaded from an API.
52
00:04:16,940 --> 00:04:19,610
And so here comes the interesting part.
53
00:04:19,640 --> 00:04:26,360
Whenever the state changes, we manually update the state in our app and React will then automatically
54
00:04:26,360 --> 00:04:30,450
rerender the user interface to reflect that latest state.
55
00:04:30,470 --> 00:04:37,440
Or in other words, react reacts to state changes by re rendering the UI.
56
00:04:37,470 --> 00:04:44,130
And that is in fact the whole reason why react is called react in the first place.
57
00:04:45,320 --> 00:04:52,400
Now, there's always been some debate over whether React is actually a framework or just a library.
58
00:04:52,760 --> 00:05:00,220
Well, the short answer is that React is actually just a library, even though I keep calling it a framework.
59
00:05:00,260 --> 00:05:06,890
And the reason for that is that React itself is really only the so called view layer.
60
00:05:07,070 --> 00:05:13,490
So if we want to build a complete real world application, we need to choose multiple external libraries
61
00:05:13,490 --> 00:05:18,590
to add to our project, for example, for routing or for data fetching.
62
00:05:18,860 --> 00:05:25,220
Now to address this, there are actually multiple frameworks that have been built on top of React.
63
00:05:25,220 --> 00:05:30,740
So frameworks that include all these functionalities that react is missing out of the box.
64
00:05:30,890 --> 00:05:35,060
And the most popular ones are called Next.js and remix.
65
00:05:35,060 --> 00:05:38,690
But again, more about all that later in the course.
66
00:05:39,630 --> 00:05:40,820
Now moving on.
67
00:05:40,830 --> 00:05:46,620
Besides all the great features that we've been talking about, maybe the biggest reason to choose react
68
00:05:46,620 --> 00:05:53,340
over all the other frameworks that are similar is because React is extremely popular.
69
00:05:53,520 --> 00:06:01,710
So according to the weekly download numbers from NPM, React is by far the most used framework and the
70
00:06:01,710 --> 00:06:05,860
difference between React and the other ones only seems to be growing.
71
00:06:05,880 --> 00:06:09,510
So react really isn't going anywhere.
72
00:06:09,720 --> 00:06:17,010
A big reason for that is that many large companies have adopted React a long time ago and so now more
73
00:06:17,010 --> 00:06:21,930
and more smaller companies all over the world are following in their footsteps.
74
00:06:21,960 --> 00:06:28,230
This means that all these companies now need react developers for their teams, which of course has
75
00:06:28,230 --> 00:06:34,530
created a huge worldwide job market with a high demand for qualified React developers.
76
00:06:34,530 --> 00:06:36,590
And these are not just any jobs.
77
00:06:36,600 --> 00:06:39,130
They are usually well paying jobs.
78
00:06:39,150 --> 00:06:46,990
Now, now even another positive outcome of React huge popularity is that now there is a very large and
79
00:06:46,990 --> 00:06:53,290
active React developer community, which means that there are always going to be lots of tutorials,
80
00:06:53,290 --> 00:07:00,220
StackOverflow questions and answers and also lots of support given to other React developers.
81
00:07:00,520 --> 00:07:06,890
And if you ask me, this is actually one of the strongest benefits of using React right now.
82
00:07:06,910 --> 00:07:15,520
Also because this huge community has grown a truly gigantic third party library ecosystem around React.
83
00:07:15,520 --> 00:07:22,930
And so now you can integrate countless useful libraries and tools into your own React applications.
84
00:07:23,920 --> 00:07:28,540
And now our last topic is that React was created by Facebook.
85
00:07:28,570 --> 00:07:36,010
Well, more specifically, React was created in 2011 by Jordan Walke, who is an engineer who was working
86
00:07:36,010 --> 00:07:37,810
at Facebook at the time.
87
00:07:37,900 --> 00:07:43,690
So that's why we say that React is backed by Facebook or now by Meta.
88
00:07:43,900 --> 00:07:51,340
So there React was first used on the newsfeed and also the chat app, and from there it spread out to
89
00:07:51,340 --> 00:07:55,360
the entire Facebook and also the Instagram applications.
90
00:07:55,570 --> 00:08:03,460
Then in 2013, React was open sourced for everyone to use it, and the rest is history.
91
00:08:03,550 --> 00:08:11,440
Because React has truly and completely transformed front end web development not only by developers
92
00:08:11,440 --> 00:08:19,030
that are using React itself, but because many other modern frameworks were created as a response which
93
00:08:19,030 --> 00:08:21,430
really changed the industry forever.
94
00:08:22,910 --> 00:08:23,510
Okay.
95
00:08:23,510 --> 00:08:28,420
So to summarize, React is really good at two things.
96
00:08:28,430 --> 00:08:35,270
First, rendering components on a web page as a user interface based on their current state.
97
00:08:35,300 --> 00:08:43,700
And second, React is really good at keeping the user interface in sync with state by re rendering or
98
00:08:43,700 --> 00:08:51,350
in other words, by reacting when the state of one of the component changes and as you will see later
99
00:08:51,350 --> 00:08:58,820
react does all this by employing something called a virtual Dom, a fiber tree, one way data flow and
100
00:08:58,820 --> 00:09:02,270
many other techniques that we will study throughout this course.
101
00:09:02,660 --> 00:09:03,380
All right.
102
00:09:03,380 --> 00:09:10,700
And so now that you have a rough overview of what React actually is, let's set up our development environment
103
00:09:10,700 --> 00:09:14,330
so that we can start writing some serious code finally.
11285
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.