Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,250 --> 00:00:07,740
Well, one huge downside is this comment here by our REACT team member.
2
00:00:08,680 --> 00:00:16,450
The statement here is clear, the context is great for low frequency updates, but not for high frequency
3
00:00:16,450 --> 00:00:16,820
ones.
4
00:00:17,110 --> 00:00:22,960
That means if you have something which changes really, let's say the user authentication status, which
5
00:00:22,960 --> 00:00:30,100
is the example I used to do, react hooks module, that is fine to be covered with the context API because
6
00:00:30,370 --> 00:00:32,470
this will not change all the time.
7
00:00:32,470 --> 00:00:33,280
Not that often.
8
00:00:33,280 --> 00:00:36,890
The same would be the case if you have something like theming on a page.
9
00:00:37,020 --> 00:00:42,400
Also something which doesn't change all the time for a favorite status like this, you could already
10
00:00:42,400 --> 00:00:44,860
argue that it's quite a high frequency update.
11
00:00:45,100 --> 00:00:50,710
Now, obviously, users might not be tapping these buttons every second, but still switching to favorite
12
00:00:50,710 --> 00:00:57,790
status of something will very likely occur way more often than logging in or changing the theme of a
13
00:00:57,790 --> 00:00:58,210
page.
14
00:00:58,570 --> 00:01:03,670
And therefore, I would argue that this is more on the high frequency side, just like maybe managing
15
00:01:03,670 --> 00:01:08,080
a shopping cart, basically anything which changes rather often.
16
00:01:08,620 --> 00:01:11,500
The context API, of course, works in that case.
17
00:01:11,920 --> 00:01:15,780
But regarding the performance, it's simply not optimized for that.
18
00:01:16,300 --> 00:01:22,840
The way to react context API works is such that whenever something changes in your context, it has
19
00:01:22,840 --> 00:01:29,020
no way of cleverly figuring out which component that uses this context really is concerned and which
20
00:01:29,020 --> 00:01:29,920
component is not.
21
00:01:30,220 --> 00:01:37,000
Which means that every component that uses you as context will rebuild, will render when you switch
22
00:01:37,000 --> 00:01:40,600
something in that context, no matter if it's directly affected or not.
23
00:01:41,200 --> 00:01:49,090
And in general, the context API is simply not optimized and not meant to be your global state management
24
00:01:49,090 --> 00:01:49,900
tool in your app.
25
00:01:49,900 --> 00:01:56,560
It's meant for some state like authentication status, like the theme, but not for all your state because
26
00:01:56,560 --> 00:02:03,040
of these missing optimizations and also dismissing intent behind the context API.
27
00:02:04,120 --> 00:02:09,729
Hence, it is great for some things like authentication, which I mentioned a couple of times, but
28
00:02:09,729 --> 00:02:14,710
not for all use cases, not for all scenarios and something like your products.
29
00:02:14,710 --> 00:02:21,400
And the favorite status is probably not what you want to manage with the context API in larger projects.
30
00:02:21,760 --> 00:02:27,730
But there still is a nonreaders alternative for debt and that's what we'll have a look at next.
3356
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.