Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,066 --> 00:00:05,200
Instructor: Now to really conclude this module,
2
00:00:05,200 --> 00:00:07,933
I just wanna show you an alternative syntax
3
00:00:07,933 --> 00:00:10,666
for writing these functions,
4
00:00:10,666 --> 00:00:14,366
any kinds of functions in JavaScript.
5
00:00:14,366 --> 00:00:17,866
A syntax which is not exclusive to React by the way,
6
00:00:17,866 --> 00:00:22,166
but which can be used in any modern JavaScript application.
7
00:00:22,166 --> 00:00:24,100
Instead of writing a function like this
8
00:00:24,100 --> 00:00:26,300
with the function keyword,
9
00:00:26,300 --> 00:00:26,600
with the function keyword,
10
00:00:26,600 --> 00:00:30,600
you can also write a so-called arrow function,
11
00:00:30,600 --> 00:00:33,433
and attached you find a link with more details
12
00:00:33,433 --> 00:00:35,233
on these arrow functions.
13
00:00:35,233 --> 00:00:38,700
Again, it's not a React specific thing.
14
00:00:38,700 --> 00:00:41,200
To use that arrow function syntax.
15
00:00:41,200 --> 00:00:44,400
You replace function with const to create a new constant
16
00:00:44,400 --> 00:00:45,966
You replace function with const to create a new constant
17
00:00:45,966 --> 00:00:48,933
with a given name app in this case.
18
00:00:48,933 --> 00:00:52,100
And then the value which you assigned to this constant
19
00:00:52,100 --> 00:00:56,533
is an arrow function written like this.
20
00:00:56,533 --> 00:00:59,233
A list of parameters then an equal sign
21
00:00:59,233 --> 00:01:01,933
and a greater sign forming such an arrow
22
00:01:01,933 --> 00:01:05,433
and then the function body between curly braces.
23
00:01:05,433 --> 00:01:09,766
And again, that's really just standard JavaScript code.
24
00:01:09,766 --> 00:01:10,533
And again, that's really just standard JavaScript code.
25
00:01:10,533 --> 00:01:14,300
You can absolutely stick to the function keyword.
26
00:01:14,300 --> 00:01:17,333
This is just a syntax, which I personally prefer
27
00:01:17,333 --> 00:01:20,500
because it's a bit shorter or yeah, I just prefer it.
28
00:01:20,500 --> 00:01:24,000
And therefore I will migrate all my functions to
29
00:01:24,000 --> 00:01:28,100
this syntax like this here in the case of card
30
00:01:28,100 --> 00:01:29,500
but you don't have to do that
31
00:01:29,500 --> 00:01:32,033
if you prefer the other syntax, it's really 100% optional.
32
00:01:32,033 --> 00:01:35,033
if you prefer the other syntax, it's really 100% optional.
33
00:01:35,033 --> 00:01:36,633
And in this case here
34
00:01:36,633 --> 00:01:39,833
it doesn't offer any benefits or anything like that.
35
00:01:39,833 --> 00:01:41,766
It's really just personal preference.
36
00:01:41,766 --> 00:01:44,033
And I want to show this syntax here
37
00:01:44,033 --> 00:01:47,033
since you will also see that in a lot of React projects
38
00:01:47,033 --> 00:01:49,666
and you therefore should be aware of it
39
00:01:49,666 --> 00:01:49,800
and you therefore should be aware of it
40
00:01:49,800 --> 00:01:52,133
that you can write your functions like this,
41
00:01:52,133 --> 00:01:56,600
any functions by the way, not just component functions.
42
00:01:56,600 --> 00:01:57,666
any functions by the way, not just component functions.
43
00:01:57,666 --> 00:02:01,300
And with that, we're really done for this module.
44
00:02:01,300 --> 00:02:02,666
It was a huge module.
45
00:02:02,666 --> 00:02:05,766
And yet we're still only scratching the surface.
46
00:02:05,766 --> 00:02:08,733
There's
way more we can explore about React,
47
00:02:08,733 --> 00:02:12,500
and in the next section,
you'll get a practice project
48
00:02:12,500 --> 00:02:17,000
which will allow you to practice
what you learned in this section.
49
00:02:17,333 --> 00:02:21,000
But thereafter we'll dive
way deeper into React.
50
00:02:21,000 --> 00:02:25,133
And we're going to explore
more crucial React features.
51
00:02:25,466 --> 00:02:29,966
Most importantly there,
after this exercise section,
52
00:02:30,233 --> 00:02:35,500
we'll explore the important concept
of managing state in React apps,
53
00:02:35,700 --> 00:02:39,633
and of building
truly interactive user interfaces.
4466
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.