All language subtitles for 007 Outsourcing Concept Items Into a Reusable Component_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
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
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 let's now outsource

these concept items here, into a separate component.

And for that of course,

I wanna outsource this list item code here in the end,

into a separate component.

For that, in the components folder,

we can add another sub folder called concept,

though of course this name as always, is up to you.

And then in there, create a concept.js file,

where I also have my concept function

for this concept component,

which of course must be exported,

to make it available outside of this file.

And then here, I want to return this list item, JSX code.

So I can cut it from here, from app.js,

and move it here into concept.js.

Now, one very important note here,

in theory, we could now create

three different concept components,

one for every core concept that we're outputting here.

But if we would do that,

we would still be duplicating, and replicating code.

And if we ever wanted to delete the paragraph,

we still would have to do that

in three different components.

That's why I'm not building three different components here.

But instead, one reusable component,

which must be configurable, though.

It must be configurable,

so that one and the same component

can output different data.

Data that's always output in the same way,

so that it always has the same shape in the end.

But the different data pieces,

the image, the title, the description,

the values stored under those keys, that will differ.

And that's the idea here with this function component.

So therefore,

it must be configurable, in order to be reusable.

And how do we make it configurable?

With help of props.

So here we can, and should, accept this props argument,

this props parameter,

which will be created and managed automatically by React,

and which will be passed

into this component function by React.

And then with that, here we can, for example,

output props.image, and here props.title.

And here it's also props.title.

And the same as true here for description,

it's props.description.

And with that, we made this component configurable,

and it does now accept an image, a title,

and a description key,

which can and should be set

when that component is being used in JSX code.

Therefore now back in app.js,

we can use this concept component here.

And for it to be usable here, we also must import it.

So here we should import concept

from ./Components/Concept/Concept.

And with that import here added, we can go down,

use the concept component like this,

as a self-closing component here,

because I'm not passing anything

between its opening and closing tabs.

And then here, we can set the image prop, like this,

because in concept, I'm extracting an image prop

So I'm looking for this key,

hence we should provide it here, on this component.

And set these to concepts(0).image.

So we're still accessing that concepts data from this array,

but we're now passing it to our own custom component.

And of course,

we're now going to do the same for the title.

Here, we should access concepts(0).title.

And last but not least, we also wanna do that

for the description of course,

and pass concepts(0).description,

as a value for the description prop.

With that, if I formatted this, the code looks like this.

And now we can easily replace those list items here,

with our own custom component,

and pass the correct data to the props.

So here for concepts(1), on that second item,

and on the third item for concepts(2),

so for the third concepts item.

And with that, we now got this reusable component,

and we are reusing it,

and we are configuring it, with help of props.

And the HTML structure, is now only defined once,

inside of this component,

but it can now easily be reused,

thanks to our custom component.

And I make sure that here I'm accessing concepts(2),

not concepts(3), which would be wrong.

And I saved this again.

I've now got the same website as before,

with those key concepts items,

but now we're building it with help of custom components,

custom reusable components.

And therefore, all three tasks that I gave you

at the beginning of the section, are now solved.

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