Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,541 --> 00:00:04,130
To provide our Redux store
2
00:00:04,130 --> 00:00:05,650
to the React app,
3
00:00:05,650 --> 00:00:08,700
we typically go into this index JS file,
4
00:00:08,700 --> 00:00:10,800
where we rendered the entire app.
5
00:00:10,800 --> 00:00:13,190
So to the highest level we can go,
6
00:00:13,190 --> 00:00:15,250
in our react application,
7
00:00:15,250 --> 00:00:17,720
to the top of our component tree,
8
00:00:17,720 --> 00:00:21,400
where we render this root component.
9
00:00:21,400 --> 00:00:22,800
And now here,
10
00:00:22,800 --> 00:00:27,800
we can import from react Redux.
11
00:00:27,920 --> 00:00:29,220
So not from Redux,
12
00:00:29,220 --> 00:00:31,630
but from react Redux.
13
00:00:31,630 --> 00:00:33,760
And what we import here,
14
00:00:33,760 --> 00:00:37,970
is now the provider component.
15
00:00:37,970 --> 00:00:39,653
This is actually a component.
16
00:00:40,520 --> 00:00:41,980
And now we wrap,
17
00:00:41,980 --> 00:00:45,770
all our root component, with provider,
18
00:00:45,770 --> 00:00:47,130
a little bit,
19
00:00:47,130 --> 00:00:50,910
as we used our own context provider components.
20
00:00:50,910 --> 00:00:52,040
If you recall that
21
00:00:52,040 --> 00:00:53,830
from earlier in the course.
22
00:00:53,830 --> 00:00:57,690
We also build our own context, provider components,
23
00:00:57,690 --> 00:00:59,270
using react context,
24
00:00:59,270 --> 00:01:01,560
and we wrapped our app
25
00:01:01,560 --> 00:01:03,490
or a part of our app
26
00:01:03,490 --> 00:01:05,260
with that as well.
27
00:01:05,260 --> 00:01:07,410
We're basically doing the same here,
28
00:01:07,410 --> 00:01:09,610
and you don't have to use provider
29
00:01:09,610 --> 00:01:12,920
on this highest component level.
30
00:01:12,920 --> 00:01:17,300
You could also wrap nested components with provider,
31
00:01:17,300 --> 00:01:19,890
but only wrapped components
32
00:01:19,890 --> 00:01:22,160
and their child components,
33
00:01:22,160 --> 00:01:23,420
and the child components
34
00:01:23,420 --> 00:01:24,500
of the child components,
35
00:01:24,500 --> 00:01:25,410
and so on.
36
00:01:25,410 --> 00:01:27,920
Only those components will have access
37
00:01:27,920 --> 00:01:29,620
to Redux thereafter.
38
00:01:29,620 --> 00:01:31,290
And if the vast majority
39
00:01:31,290 --> 00:01:33,100
of your components need access
40
00:01:33,100 --> 00:01:34,080
to the store,
41
00:01:34,080 --> 00:01:36,080
if maybe your entire app,
42
00:01:36,080 --> 00:01:37,670
needs access to the store,
43
00:01:37,670 --> 00:01:39,590
you should typically provide,
44
00:01:39,590 --> 00:01:41,603
on this highest level.
45
00:01:43,290 --> 00:01:46,330
Now just by wrapping Provider around app,
46
00:01:46,330 --> 00:01:49,140
we're not telling react Redux
47
00:01:49,140 --> 00:01:50,650
and react therefore,
48
00:01:50,650 --> 00:01:53,300
which store we wanna provide.
49
00:01:53,300 --> 00:01:55,560
Sure. We only have one store,
50
00:01:55,560 --> 00:01:57,950
but that's stored in this index JS file,
51
00:01:57,950 --> 00:02:00,130
react Redux of course doesn't know
52
00:02:00,130 --> 00:02:03,010
that data file holds our store.
53
00:02:03,010 --> 00:02:03,843
Instead we have
54
00:02:03,843 --> 00:02:06,363
to import our store from,
55
00:02:07,550 --> 00:02:10,289
store index in this case.
56
00:02:10,289 --> 00:02:11,270
So that store,
57
00:02:11,270 --> 00:02:13,330
which we're exporting in there,
58
00:02:13,330 --> 00:02:14,440
we're importing this
59
00:02:14,440 --> 00:02:16,250
into index JS,
60
00:02:16,250 --> 00:02:18,000
and on this provider,
61
00:02:18,000 --> 00:02:20,380
which we import from react Redux.
62
00:02:20,380 --> 00:02:22,250
We have a store prop,
63
00:02:22,250 --> 00:02:23,810
which we have to set.
64
00:02:23,810 --> 00:02:25,820
And this one's a value,
65
00:02:25,820 --> 00:02:28,670
a value which is our Redux store.
66
00:02:28,670 --> 00:02:29,800
So this store,
67
00:02:29,800 --> 00:02:31,270
which we're importing here,
68
00:02:31,270 --> 00:02:33,330
we're setting this as a value,
69
00:02:33,330 --> 00:02:34,850
for the store prop
70
00:02:34,850 --> 00:02:37,180
on this provider component.
71
00:02:37,180 --> 00:02:40,430
And that now provides our Redux store,
72
00:02:40,430 --> 00:02:42,253
cue this react app.
73
00:02:43,200 --> 00:02:44,210
Now on its own,
74
00:02:44,210 --> 00:02:45,900
that doesn't do much.
75
00:02:45,900 --> 00:02:47,770
Now to store is provided,
76
00:02:47,770 --> 00:02:49,280
but that doesn't change anything
77
00:02:49,280 --> 00:02:50,320
at the moment.
78
00:02:50,320 --> 00:02:53,460
But now our components in this app,
79
00:02:53,460 --> 00:02:54,600
the app component,
80
00:02:54,600 --> 00:02:56,690
and any other child components,
81
00:02:56,690 --> 00:02:58,900
can tap into that store.
82
00:02:58,900 --> 00:03:01,340
They can get data out of the store.
83
00:03:01,340 --> 00:03:03,090
They can set up a subscription
84
00:03:03,090 --> 00:03:05,320
to that data to be precise,
85
00:03:05,320 --> 00:03:08,995
and they also can dispatch actions.
86
00:03:08,995 --> 00:03:11,513
And that's what we're therefore going to do next.
5651
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.