Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,040 --> 00:00:04,450
So, now our cart is working correctly
2
00:00:04,450 --> 00:00:07,430
and we learned a lot about where to put code
3
00:00:07,430 --> 00:00:09,500
how to run async code with Redux
4
00:00:09,500 --> 00:00:11,500
and how to handle side effects.
5
00:00:11,500 --> 00:00:13,220
And we spent a lot of time on that
6
00:00:13,220 --> 00:00:15,490
because it is an important topic
7
00:00:15,490 --> 00:00:19,560
and knowing your options there is extremely important.
8
00:00:19,560 --> 00:00:21,100
I can't emphasize this enough.
9
00:00:21,100 --> 00:00:24,430
It's important to understand how that works.
10
00:00:24,430 --> 00:00:28,850
But besides handling async tasks and side effects with Redux
11
00:00:28,850 --> 00:00:31,400
and understanding where to put our code
12
00:00:31,400 --> 00:00:33,720
there was another important topic
13
00:00:33,720 --> 00:00:36,480
I wanted to have a look at in this module.
14
00:00:36,480 --> 00:00:39,460
And that would be the Redux Devtools.
15
00:00:39,460 --> 00:00:42,220
These are extra tools which we can use
16
00:00:42,220 --> 00:00:46,740
which make debugging Redux and our Redux state a bit easier.
17
00:00:46,740 --> 00:00:49,010
Because in more complex applications
18
00:00:49,010 --> 00:00:51,300
with a lot of Redux state handled
19
00:00:51,300 --> 00:00:53,110
by a lot of different slices
20
00:00:53,110 --> 00:00:55,460
and a lot of different actions going on
21
00:00:55,460 --> 00:00:59,420
it can be difficult to find errors in your debug state
22
00:00:59,420 --> 00:01:01,940
in the order of your actions and so on.
23
00:01:01,940 --> 00:01:04,190
And sometimes it might be interesting to look
24
00:01:04,190 --> 00:01:07,670
into the current state of your overall Redux store
25
00:01:07,670 --> 00:01:10,010
without having to dive into different parts
26
00:01:10,010 --> 00:01:14,000
of the UI to verify that everything works correctly.
27
00:01:14,000 --> 00:01:17,410
And that is what we can use the Redux Devtools for.
28
00:01:17,410 --> 00:01:20,560
You can simply search for Redux Devtools
29
00:01:20,560 --> 00:01:22,770
and you'll find a GitHub repository
30
00:01:22,770 --> 00:01:24,620
about the Redux Devtools
31
00:01:24,620 --> 00:01:26,880
and the Redux Devtools can be used
32
00:01:26,880 --> 00:01:29,670
and installed as a browser extension.
33
00:01:29,670 --> 00:01:32,270
You can always install them as a stand alone app
34
00:01:32,270 --> 00:01:37,150
but I personally find the browser extension easiest to use.
35
00:01:37,150 --> 00:01:38,270
So, here I'm on Chrome
36
00:01:38,270 --> 00:01:40,500
so I'll pick that Chrome browser extension
37
00:01:40,500 --> 00:01:43,750
and here you can install this Chrome extension.
38
00:01:43,750 --> 00:01:45,800
Now, I already do have it installed.
39
00:01:45,800 --> 00:01:48,350
You can install it with a click of a button
40
00:01:48,350 --> 00:01:53,350
and once you did so, you will be able to use it right away.
41
00:01:53,470 --> 00:01:56,610
When using Redux without Redux toolkit
42
00:01:56,610 --> 00:01:58,910
you had to set up some extra code
43
00:01:58,910 --> 00:02:01,240
to make Redux Devtools work.
44
00:02:01,240 --> 00:02:05,570
With Redux tool kit it will conveniently work out of the box
45
00:02:05,570 --> 00:02:08,690
and you should then have access to that extension.
46
00:02:08,690 --> 00:02:11,620
Now, here I have an in cognitive tab open
47
00:02:11,620 --> 00:02:14,170
and there I don't have access to my extensions
48
00:02:14,170 --> 00:02:15,780
so, I'll quickly run the application
49
00:02:15,780 --> 00:02:18,200
in a standard Chrome tab again
50
00:02:18,200 --> 00:02:23,200
and when I do so I have this Redux Devtools icon here
51
00:02:23,810 --> 00:02:25,800
or in the browser Devtools
52
00:02:25,800 --> 00:02:29,303
you also should find Redux here as an option.
53
00:02:30,710 --> 00:02:32,260
And if you open that
54
00:02:33,150 --> 00:02:36,810
it will open this Redux Devtools panel here
55
00:02:36,810 --> 00:02:40,750
and now here, you have insights into your Redux store
56
00:02:40,750 --> 00:02:43,670
into your actions and much more.
57
00:02:43,670 --> 00:02:46,280
On the left side, you for example, see the actions
58
00:02:46,280 --> 00:02:47,850
that were dispatched.
59
00:02:47,850 --> 00:02:52,090
And if I reload, we see that's in it and replace cart.
60
00:02:52,090 --> 00:02:56,010
In it, is this automatically dispatched first action
61
00:02:56,010 --> 00:03:00,450
that applies all your initial states to Redux
62
00:03:00,450 --> 00:03:02,650
so that initializes the store
63
00:03:02,650 --> 00:03:05,370
and replace card was dispatched
64
00:03:05,370 --> 00:03:07,563
because we fetched the card initially.
65
00:03:08,470 --> 00:03:10,720
Now, if I add something to the card, you see
66
00:03:10,720 --> 00:03:12,920
add item to cart was dispatched
67
00:03:12,920 --> 00:03:16,710
and our show notification actions which makes sense
68
00:03:16,710 --> 00:03:18,750
because these are all the actions
69
00:03:18,750 --> 00:03:21,910
which are being dispatched when we add an item.
70
00:03:21,910 --> 00:03:24,500
First add item to cart it's dispatched
71
00:03:24,500 --> 00:03:27,460
and when that card state then changed
72
00:03:27,460 --> 00:03:32,460
user App.js kicks in and dispatches send card data
73
00:03:32,480 --> 00:03:36,470
that's not locked because that itself is not an action type
74
00:03:36,470 --> 00:03:39,570
but instead as part of send card data
75
00:03:39,570 --> 00:03:42,580
we then do dispatch these notification actions
76
00:03:42,580 --> 00:03:45,300
which is why we see them here as well.
77
00:03:45,300 --> 00:03:48,380
And you can click on those actions to get insights
78
00:03:48,380 --> 00:03:52,130
into the data that was transported by that action
79
00:03:52,130 --> 00:03:55,080
and how that changed your state.
80
00:03:55,080 --> 00:03:57,940
You see the data, if you click on action
81
00:03:57,940 --> 00:04:00,120
there you see the payload off the action
82
00:04:00,120 --> 00:04:02,760
and this unique identifier.
83
00:04:02,760 --> 00:04:03,900
Here, we can also see
84
00:04:03,900 --> 00:04:06,870
the automatically created unique identifiers
85
00:04:06,870 --> 00:04:08,790
Redux toolkit gives us
86
00:04:08,790 --> 00:04:13,660
as you see it's basically your slice name.
87
00:04:13,660 --> 00:04:16,070
So, in card it's this slice name
88
00:04:16,070 --> 00:04:18,910
and then the method name of this reducer method
89
00:04:18,910 --> 00:04:22,860
that is the unique identifier created by Redux toolkit
90
00:04:22,860 --> 00:04:24,563
and then here we have our payload.
91
00:04:25,870 --> 00:04:30,370
We also see how the state looks like there after.
92
00:04:30,370 --> 00:04:33,780
So, how the state looks after this action was performed
93
00:04:33,780 --> 00:04:37,190
and we see how it was updated if we click on diff.
94
00:04:37,190 --> 00:04:38,530
Therefore add item to cart
95
00:04:38,530 --> 00:04:42,110
we see that the total quantity was changed from six to seven
96
00:04:42,110 --> 00:04:46,410
changed one set from false to true and in the items
97
00:04:46,410 --> 00:04:49,280
we see that the quantity of that first item changed
98
00:04:49,280 --> 00:04:50,480
and so on.
99
00:04:50,480 --> 00:04:54,100
So, that's super useful to understand the impact
100
00:04:54,100 --> 00:04:55,143
of your actions.
101
00:04:56,190 --> 00:05:00,210
You can even do something which is called time traveling.
102
00:05:00,210 --> 00:05:02,660
You can jump to an older state like this one
103
00:05:02,660 --> 00:05:05,180
by clicking on it and then clicking on jump
104
00:05:05,180 --> 00:05:07,760
and you see now the notification is gone
105
00:05:07,760 --> 00:05:11,160
and we're back to the card with six items.
106
00:05:11,160 --> 00:05:14,450
And we can then start debugging here again if we want to
107
00:05:14,450 --> 00:05:16,300
and we can then also jump back
108
00:05:16,300 --> 00:05:18,930
to a newer state if we want to.
109
00:05:18,930 --> 00:05:21,070
So, that can be really convenient
110
00:05:21,070 --> 00:05:24,240
and therefore the Redux Devtools are a piece of software
111
00:05:24,240 --> 00:05:27,910
I can only encourage you to use and play around with
112
00:05:27,910 --> 00:05:31,170
to get deeper insights into your Redux store
113
00:05:31,170 --> 00:05:33,550
and to debug your Redux behavior
114
00:05:33,550 --> 00:05:36,003
and fully understand what's going on.
9107
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.