All language subtitles for 005 Using Context Data In Components_Downloadly.ir_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

So now that the Context is defined

and we wrap our components here with our Context provider,

it's time to start using that Context.

Now I mentioned that I wanna show the notification here

in this underscore App.js file.

And I would actually have problems with that

because that's also the file

where we wrap with our Notification Context Provider.

So this component itself,

this MyApp component in which I use the notification

is not wrapped by Notification Context Provider

because it's this component's JSX code

where we do the wrapping.

Hence we can't tap into our Context here

inside of this component function.

But that's no problem,

we can get rid of the notification here

and cut it and remove its import,

and instead of just use the layout component

because that also is a wrapper around all our other content.

And it's the perfect component for rendering a notification.

Also, if we have a look at its name, layout,

it is per definition, a wrapper for visual content.

And therefore, if I go to my layout component,

I'll simply add the notification there,

and then of course also add the import

for the notification component from the UI folder like this.

And now in the layout component,

we can tap into our Context.

And for that I'll import the use Context hook

which allows us to do that.

We can call use Context and then pass the Context

to which we want to establish a connection

as a argument to use Context.

So to make that work,

we should import the Context to which we want to connect.

And that's the Notification Context,

not the Notification Context Provider,

but just the Notification Context,

because I just want to connect to this Context object here.

So not the provider component, but this Context object,

this one, which is exported as a default.

That's what I need for use Context.

So in the layout component,

that's what I'll import from my store folder.

So for my store Notification Context file.

So pass Notification Context as a argument to use Context

and that gives us access to that Context value.

Now we can use that Context

to call, show, or a hide notification,

or to get the current notification data.

And that's what we need here in this layout component

to conditionally show the notification.

So here I'll then get access to the notification,

and I'll name this activeNotification.

So I'll store it in notification, managed by my Context

in a constant here in this component.

And if that is not null,

so if we have an activeNotification in our Context,

then I want to render this notification

with the data stored in activeNotification.

So we want to render notification conditionally,

and we can do it as we always do it,

with this syntax here, and then just populate the props here

with the active values from the active notification.

So activeNotification.title,

and also set the message to activeNotification.message,

and for the status,

I'll set this to activeNotification.status.

So now this notification component is rendered

whenever we have an activeNotification in our store,

in our Context.

At the moment though, we never have an activeNotification

because we have no place

that would trigger the show notification handler

by calling show notification on the Context object.

And that's what I want to change now.

Now that all the Context is set up,

I want to dive into the components

where we do send http requests

to then call show notification

from inside those components

to show and update that notification

with the appropriate data.

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