All language subtitles for 008 Creating a Concrete Store_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,820 --> 00:00:07,710 So in the bookstore, I'll now add a product stash store, Jaspal, of course, you can name this whatever 2 00:00:07,710 --> 00:00:14,730 you want and here I'll import in it store from the store, Jaspal. 3 00:00:16,230 --> 00:00:21,750 Now you're all to configure a store function, which is not getting any arguments, but where we can 4 00:00:21,750 --> 00:00:29,580 now set up our actions and our initial state and then I'll call in in its store and passed it data to 5 00:00:29,580 --> 00:00:29,750 it. 6 00:00:30,240 --> 00:00:33,150 So the first thing is my actions, and that should be an object. 7 00:00:33,330 --> 00:00:38,280 And now here you have some identifiers like, let's say toggle fav. 8 00:00:39,090 --> 00:00:40,620 That's a property name here. 9 00:00:41,930 --> 00:00:47,640 And the value, as I mentioned earlier, should be a function where you get your current state, so 10 00:00:47,690 --> 00:00:48,890 Curre state. 11 00:00:50,880 --> 00:00:53,860 And you return the part of the state you want to update. 12 00:00:54,390 --> 00:00:56,310 So here I return. 13 00:00:57,600 --> 00:01:01,980 And new object with a product key, because you're a plan on updating the products. 14 00:01:02,960 --> 00:01:06,260 Where I get my curse state products. 15 00:01:07,150 --> 00:01:11,860 And keep in mind, that state always is this global state thing, which could manage different kinds 16 00:01:11,860 --> 00:01:12,370 of state. 17 00:01:13,930 --> 00:01:20,380 But the way we set up this despatching is that we will update the global state with our return value 18 00:01:20,380 --> 00:01:23,790 of when we call our action, but merged it with the existing states. 19 00:01:23,790 --> 00:01:26,220 So here we only have to return what we want to change. 20 00:01:27,070 --> 00:01:31,480 And here I want to return a new object with a product key because I want to change my products with 21 00:01:31,480 --> 00:01:32,890 current state products. 22 00:01:34,110 --> 00:01:39,720 But of course, now here I want to switch to favorite status, so I'll use the same logic as before, 23 00:01:40,260 --> 00:01:45,630 which we already set up multiple times, for example, here in the products context file in there. 24 00:01:45,640 --> 00:01:49,980 It's this logic here for creating an updated list of products. 25 00:01:51,480 --> 00:01:57,870 So do that in here, and current product list is now simply current state dot product, so that's our 26 00:01:57,870 --> 00:01:59,190 current list of products. 27 00:01:59,580 --> 00:02:04,310 So let's replace all of that with current state products and the product I.D. here. 28 00:02:05,100 --> 00:02:06,850 That's, of course, something we all need. 29 00:02:07,350 --> 00:02:12,150 So actually, we should alter this action here and not just expect the global state. 30 00:02:12,480 --> 00:02:20,610 But you're also a product I.D., let's say, so that we can use that here to then here I return my products. 31 00:02:21,540 --> 00:02:28,370 Key with updated products as a value now this is my actions object, and we'll have to make sure that 32 00:02:28,370 --> 00:02:30,260 this I.D. thing is handled soon. 33 00:02:30,290 --> 00:02:37,400 But now, for now, the syste actions object and now in its store can be called by forwarding our actions 34 00:02:37,400 --> 00:02:41,960 object, which will be registered in our global actions, object in the store. 35 00:02:42,470 --> 00:02:46,160 And then an initial state where I also want to have some products. 36 00:02:46,730 --> 00:02:51,170 And their products, of course, can be taken from the products context file. 37 00:02:51,470 --> 00:02:54,350 It's this array of products. 38 00:02:54,350 --> 00:03:00,770 Let's copy it from there and move it into the product store file here as an array. 39 00:03:02,970 --> 00:03:12,180 So now we have that file which initializes our store with our actions and our starting state, our starting 40 00:03:12,180 --> 00:03:14,290 object with our starting list of products. 41 00:03:15,060 --> 00:03:22,040 Now I will export this configure store function where all of this is happening. 42 00:03:22,050 --> 00:03:24,180 So this function here so we can use it. 43 00:03:24,600 --> 00:03:29,430 And let's briefly go back to the storage as followed and also make sure that when an action is dispatched 44 00:03:29,430 --> 00:03:36,420 and we forward the global state, we also can forward any value, any payload that is passed along with 45 00:03:36,420 --> 00:03:37,000 the action. 46 00:03:37,290 --> 00:03:42,060 So here to dispatch function should not just be getting an action identifier, but also, let's say 47 00:03:42,060 --> 00:03:47,130 a payload so that we can forward that payload to our action function as well. 48 00:03:47,280 --> 00:03:51,990 And payload can now be an object or just a string number, whatever you need. 49 00:03:52,260 --> 00:03:58,560 And for example, that allows us to set up action here in the product store file where we expect to 50 00:03:58,560 --> 00:04:00,450 get a product that would be the payload. 51 00:04:00,450 --> 00:04:03,220 We then have to pass along when we call dispatch. 52 00:04:03,470 --> 00:04:04,590 And that's the missing thing. 53 00:04:04,980 --> 00:04:09,360 We said all of that up, but we're not using our custom store here. 5603

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