Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,090 --> 00:00:04,870
So for filling those pages with life,
2
00:00:04,870 --> 00:00:07,150
I will start with that starting page.
3
00:00:07,150 --> 00:00:09,970
So with index.js in the pages folder
4
00:00:09,970 --> 00:00:11,823
with this index.js file.
5
00:00:12,750 --> 00:00:15,160
In there, we can add our component
6
00:00:15,160 --> 00:00:17,340
for example, the homepage component.
7
00:00:17,340 --> 00:00:19,800
And of course also exports that,
8
00:00:19,800 --> 00:00:21,620
that's always important.
9
00:00:21,620 --> 00:00:25,090
And then we wanna return the JSX code
10
00:00:25,090 --> 00:00:27,380
that defines this component,
11
00:00:27,380 --> 00:00:31,850
and that therefore defines what should show up on the page.
12
00:00:31,850 --> 00:00:34,990
And here, what should show up in the end
13
00:00:34,990 --> 00:00:39,160
is our meetup list component.
14
00:00:39,160 --> 00:00:42,690
And that's a component that wants a meetups prop here
15
00:00:42,690 --> 00:00:45,350
which holds a list of meetups,
16
00:00:45,350 --> 00:00:48,570
which we then map into a list of JSX elements.
17
00:00:48,570 --> 00:00:51,330
Where every meetup needs to have an ID,
18
00:00:51,330 --> 00:00:54,230
an image, a title, and an address.
19
00:00:54,230 --> 00:00:57,680
And hence, when we use meetup lists in our page component
20
00:00:57,680 --> 00:01:00,810
we need to make sure that we do provide
21
00:01:00,810 --> 00:01:03,410
that meetups prop to it.
22
00:01:03,410 --> 00:01:06,220
It's also worth noting that meetup list
23
00:01:06,220 --> 00:01:08,350
like meetup item and so on,
24
00:01:08,350 --> 00:01:11,290
is a regular React component.
25
00:01:11,290 --> 00:01:13,950
It is however stored in a components' folder,
26
00:01:13,950 --> 00:01:16,270
not in a pages folder.
27
00:01:16,270 --> 00:01:18,120
Now that folder name is up to you.
28
00:01:18,120 --> 00:01:19,800
The only reserved name in the end
29
00:01:19,800 --> 00:01:21,560
is the page's folder name.
30
00:01:21,560 --> 00:01:24,600
You can name your other folders however you want.
31
00:01:24,600 --> 00:01:26,070
I named it components though,
32
00:01:26,070 --> 00:01:29,140
because I do store React components in there.
33
00:01:29,140 --> 00:01:32,530
But the important difference to the page components is
34
00:01:32,530 --> 00:01:35,400
that those components stored in there
35
00:01:35,400 --> 00:01:38,730
will not be loaded as pages automatically.
36
00:01:38,730 --> 00:01:40,540
Instead, we can simply use them
37
00:01:40,540 --> 00:01:43,220
in the JSX code of other components,
38
00:01:43,220 --> 00:01:45,930
including page components.
39
00:01:45,930 --> 00:01:48,610
So we can include the meetup list component
40
00:01:48,610 --> 00:01:51,710
on our main page here, on the homepage.
41
00:01:51,710 --> 00:01:54,310
Simply by going to that homepage component
42
00:01:54,310 --> 00:01:57,230
and importing meetup lists there
43
00:01:57,230 --> 00:02:00,230
from going up one level components,
44
00:02:00,230 --> 00:02:01,650
meetups, meetup list.
45
00:02:03,350 --> 00:02:06,110
So I import this component from this file
46
00:02:06,110 --> 00:02:07,950
and then we can use it here.
47
00:02:07,950 --> 00:02:09,600
And hence here we can, for example,
48
00:02:09,600 --> 00:02:12,100
output meetup lists like this
49
00:02:12,100 --> 00:02:14,190
and then set this meetups prop
50
00:02:14,190 --> 00:02:16,430
which this component expects.
51
00:02:16,430 --> 00:02:18,600
And for the moment we can then construct
52
00:02:18,600 --> 00:02:20,380
some dummy meetups here,
53
00:02:20,380 --> 00:02:21,980
later we'll be able to create
54
00:02:21,980 --> 00:02:24,400
and store our own meetups in a database.
55
00:02:24,400 --> 00:02:26,820
For the moment let's use some dummy meetups.
56
00:02:26,820 --> 00:02:30,023
And that actually should be an array,
57
00:02:30,910 --> 00:02:34,430
an array of meetup items where every item has an ID,
58
00:02:34,430 --> 00:02:37,600
for example M1 for the first meetup,
59
00:02:37,600 --> 00:02:42,600
where every meetup then has a title like a first meetup,
60
00:02:43,250 --> 00:02:46,030
where every meetup then has an image.
61
00:02:46,030 --> 00:02:49,840
And for this here, I'm using an image from Wikipedia
62
00:02:49,840 --> 00:02:51,930
which is not taken by me
63
00:02:51,930 --> 00:02:55,220
but which instead was taken by Tomas Wolf
64
00:02:55,220 --> 00:02:58,020
to whom I therefore wanna give due credits.
65
00:02:58,020 --> 00:02:59,780
So this image is taken by him.
66
00:02:59,780 --> 00:03:02,070
And I'll just grab that image here,
67
00:03:02,070 --> 00:03:04,150
grab the URL to that image
68
00:03:04,150 --> 00:03:07,150
because we're not going to implement file upload here
69
00:03:07,150 --> 00:03:10,323
and use that here as an image URL.
70
00:03:11,630 --> 00:03:16,146
Now, every meetup should then also have an address
71
00:03:16,146 --> 00:03:18,340
because that's another piece of data
72
00:03:18,340 --> 00:03:22,130
which we extract in the meetup list component here.
73
00:03:22,130 --> 00:03:24,940
So we wanna have that address field here as well.
74
00:03:24,940 --> 00:03:28,561
And I'll set this to some address 5,
75
00:03:28,561 --> 00:03:31,780
12345, Some City.
76
00:03:31,780 --> 00:03:33,930
And we can also add a description
77
00:03:33,930 --> 00:03:36,400
even though we don't need that yet, but I will add it here.
78
00:03:36,400 --> 00:03:40,700
A description with, "this is our first meetup."
79
00:03:40,700 --> 00:03:43,400
And now we can of course replicate this.
80
00:03:43,400 --> 00:03:44,810
So duplicate this meetup
81
00:03:44,810 --> 00:03:47,500
and give the second one an idea of M2
82
00:03:47,500 --> 00:03:49,430
and then name it as second meetup,
83
00:03:49,430 --> 00:03:51,550
and this is a second meetup.
84
00:03:51,550 --> 00:03:53,000
And maybe change the address
85
00:03:53,000 --> 00:03:55,920
and use a different image as well if you want to.
86
00:03:55,920 --> 00:03:57,570
I'll stick to the same one.
87
00:03:57,570 --> 00:04:00,410
And then we can pass this dummy meetups array
88
00:04:00,410 --> 00:04:03,403
into this meetups prop of the meetup list component.
89
00:04:04,250 --> 00:04:06,190
And that's all standard React.
90
00:04:06,190 --> 00:04:09,400
There's nothing NextJS specific about that.
91
00:04:09,400 --> 00:04:12,600
The only NextJS specific part here
92
00:04:12,600 --> 00:04:14,530
is that we're in a special component
93
00:04:14,530 --> 00:04:18,670
which is special because it's in such a page file.
94
00:04:18,670 --> 00:04:22,150
Other than that, it's a regular React component.
95
00:04:22,150 --> 00:04:23,580
And if we now save that,
96
00:04:23,580 --> 00:04:27,650
if we save this and restart our development server here
97
00:04:27,650 --> 00:04:31,240
because it crashed, because I had no page content initially.
98
00:04:31,240 --> 00:04:33,970
If we visit local host 3000
99
00:04:33,970 --> 00:04:36,460
we should see this on the screen.
100
00:04:36,460 --> 00:04:40,400
This is not the finished look, but this shows that it works
101
00:04:40,400 --> 00:04:43,710
and that our first page has loaded successfully.
102
00:04:43,710 --> 00:04:47,370
And we're using another React component in that page,
103
00:04:47,370 --> 00:04:50,410
a component which is not a page component,
104
00:04:50,410 --> 00:04:52,283
that is also worth pointing out.
105
00:04:53,350 --> 00:04:56,020
And with that, we got this page in place.
106
00:04:56,020 --> 00:04:59,270
Let's now also work on that new meetup page
107
00:04:59,270 --> 00:05:02,103
and let's make sure we render some content here as well.
8244
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.