All language subtitles for 013 Attaching Payloads to Actions_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,180 --> 00:00:04,950 Let's dig deeper into Redux. 2 00:00:04,950 --> 00:00:08,850 Up to this point, we only dispatched simple actions. 3 00:00:08,850 --> 00:00:11,550 They only had a type, nothing else. 4 00:00:11,550 --> 00:00:14,780 In reality, you often wanna dispatch actions 5 00:00:14,780 --> 00:00:17,580 that also carry an extra value. 6 00:00:17,580 --> 00:00:19,260 Let's say we wanna add a new button 7 00:00:19,260 --> 00:00:24,260 to the counter component, which says increase by 5. 8 00:00:24,890 --> 00:00:26,950 We could, of course also had a decreased button 9 00:00:26,950 --> 00:00:29,790 but let's stick to the increase button for now. 10 00:00:29,790 --> 00:00:31,920 Now, even though it has this label 11 00:00:31,920 --> 00:00:34,610 it of course only increases this by one 12 00:00:34,610 --> 00:00:38,060 because I still just call the incrementHandler here 13 00:00:38,060 --> 00:00:39,593 and dispatch increment. 14 00:00:40,600 --> 00:00:43,040 Of course, we could now go to the store 15 00:00:43,040 --> 00:00:47,630 and prepare our Reducer for another action type 16 00:00:47,630 --> 00:00:49,370 which is increaseby5 17 00:00:50,920 --> 00:00:55,800 where we then return our updated state, 18 00:00:55,800 --> 00:00:58,533 where we increase the state.counter by 5. 19 00:00:59,460 --> 00:01:01,360 But that's not scalable. 20 00:01:01,360 --> 00:01:04,080 We can't predict all possible values 21 00:01:04,080 --> 00:01:05,890 we might wanna support. 22 00:01:05,890 --> 00:01:08,550 The counter of course is just a dummy example. 23 00:01:08,550 --> 00:01:11,010 But if you're using this in a real project, 24 00:01:11,010 --> 00:01:12,700 which we'll do later in the course, 25 00:01:12,700 --> 00:01:16,710 and you need to work with any user input, for example, 26 00:01:16,710 --> 00:01:21,003 you can't hard-code those values here in your Reducer. 27 00:01:22,420 --> 00:01:25,530 Instead, the action which we dispatch 28 00:01:25,530 --> 00:01:27,370 and which reaches the Reducer 29 00:01:27,370 --> 00:01:30,513 often needs to carry extra data. 30 00:01:31,410 --> 00:01:36,410 So that, for example, we have a increase action type here 31 00:01:36,970 --> 00:01:39,420 and that action type 32 00:01:39,420 --> 00:01:42,440 does not increase the counter by a fixed number, 33 00:01:42,440 --> 00:01:45,610 but instead we expect to get the value 34 00:01:45,610 --> 00:01:49,290 by which you wanna increase from the action. 35 00:01:49,290 --> 00:01:51,530 In there we could say that we expect 36 00:01:51,530 --> 00:01:56,100 to get the value property or have an amount property 37 00:01:56,100 --> 00:01:57,210 or whatever it is. 38 00:01:57,210 --> 00:01:59,530 And then we wanna increase by that. 39 00:01:59,530 --> 00:02:01,760 That would be a reasonable expectation. 40 00:02:01,760 --> 00:02:04,110 And that's of course, a very common scenario 41 00:02:04,110 --> 00:02:07,163 hence Redux and React Redux supports it. 42 00:02:08,020 --> 00:02:11,830 Back in the counter, we can now add a new function here, 43 00:02:11,830 --> 00:02:16,830 the increaseHandler, and in there we again wanna dispatch, 44 00:02:18,370 --> 00:02:21,120 but now the action which we wanna dispatch 45 00:02:21,120 --> 00:02:23,780 will not just have a type. 46 00:02:23,780 --> 00:02:26,320 It will have one as the type is increase 47 00:02:26,320 --> 00:02:30,180 but it cannot also get an extra payload, 48 00:02:30,180 --> 00:02:32,700 extra data which it carries. 49 00:02:32,700 --> 00:02:36,280 For example, an extra amount property. 50 00:02:36,280 --> 00:02:39,970 And this property name is entirely up to you. 51 00:02:39,970 --> 00:02:41,740 It's your action. 52 00:02:41,740 --> 00:02:43,450 It's your action object. 53 00:02:43,450 --> 00:02:46,970 You can add whichever properties you want. 54 00:02:46,970 --> 00:02:49,100 So here I'll add an amount property 55 00:02:49,100 --> 00:02:51,740 and set amount to 5 here. 56 00:02:51,740 --> 00:02:54,370 Of course 5 is therefore still hard-coded 57 00:02:54,370 --> 00:02:57,440 here in this function, but that's just a demo. 58 00:02:57,440 --> 00:02:59,450 Of course, this value could be coming 59 00:02:59,450 --> 00:03:01,300 from an input field. 60 00:03:01,300 --> 00:03:03,080 Here it's hard-coded 61 00:03:03,080 --> 00:03:06,763 but now we can point at the increaseHandler here. 62 00:03:09,020 --> 00:03:12,150 Now we add this extra payload to the action 63 00:03:12,150 --> 00:03:15,070 and in our store, in the Reducer function, 64 00:03:15,070 --> 00:03:16,810 when the type is increased, 65 00:03:16,810 --> 00:03:20,770 we do expect this amount field on the action. 66 00:03:20,770 --> 00:03:22,787 Therefore, of course, you need to make sure 67 00:03:22,787 --> 00:03:25,730 that the property you're accessing here, 68 00:03:25,730 --> 00:03:27,840 on the action in the Reducer, 69 00:03:27,840 --> 00:03:29,700 has exactly the same name 70 00:03:29,700 --> 00:03:33,790 as the property you add to the action when you dispatch it. 71 00:03:33,790 --> 00:03:36,713 Otherwise you won't be able to extract this data. 72 00:03:38,340 --> 00:03:40,840 Hence now, if we save this and reload this, 73 00:03:40,840 --> 00:03:45,230 we do increase by five, but now this is very flexible. 74 00:03:45,230 --> 00:03:49,280 We can easily change this to 10 and for completeness sake, 75 00:03:49,280 --> 00:03:52,110 change the button text to 10 as well. 76 00:03:52,110 --> 00:03:54,390 And now we increase by 10. 77 00:03:54,390 --> 00:03:58,920 It works just like that because now the Reducer is dynamic. 78 00:03:58,920 --> 00:04:02,190 It extracts an action payload. 79 00:04:02,190 --> 00:04:05,970 And action payloads are very common, often needed, 80 00:04:05,970 --> 00:04:08,410 and as you see, it's super easy to add them. 81 00:04:08,410 --> 00:04:11,710 It's just an extra property which you add 82 00:04:11,710 --> 00:04:13,423 to your action objects. 6372

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.