All language subtitles for 006 More Redux Basics_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
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

Original subtitles

We are dispatching an action here

and that action has a type of increment.

Typically when using Redux,

the goal is to do different things inside of the reducer

for different actions.

And that's why you get the action as a second argument here.

You get the current state and then the action

that was dispatched that caused this reducer to run.

And therefore in the reducer,

we can of course, look into this action.

We can check if the action.type

is equal to increment for example.

And if that's the case, then let's say,

I wanna return this increment that counter.

Otherwise, if a different action

like the default initialization action was dispatched,

I wanna return the unchanged state let's say,

and then we'll also change the value

we have in our state here

because now for the initialization,

we will not increment the counter

but return the unchanged default state.

And then for the increment action,

we will return the updated counter.

So with this little change made

if we execute this file again, we now have counter one here

because for the initialization, it's no longer incremented.

And that we can, of course, also dispatch other actions,

we could dispatch an action of type, decrement.

So with an identifier of detriment,

then we just need to add the appropriate code here.

If action.type equals decrement,

and then just return our new state object

where counter is set

to the state.counter minus one, like this.

If we do this and save doesn't run our file again,

we have counter one counter zero as outputs.

This first output is coming from our subscription

after the increment action

and then we change the state again

hence the subscription triggers again

and to therefore we now see counter zero

because we decrease the counter here.

That's how Redux works.

Now there is a bit more to it and more things you can do

but that is the heart of Redux and of how it works.

Obviously, we're not using it with React here

but that is how Redux works no matter how you use it.

And it indeed isn't a library restricted to React,

you can use Redux in any JavaScript project.

There even are implementations

for other programming languages as well.

But of course here we are going to use it with React though.

And therefore in the next lecture,

let's now explore how we would use Redux

in a React application.

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