All language subtitles for 003 The Starting Project_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

Now, to get started with hooks,

you find a extra project attached to this lecture here,

which acts as a starting project for this course section.

It's this starting project

which we're going to use

to dive into the different hooks,

to use them, to learn how they work

and to then also write our own custom hooks.

So this is a simple React project created

with Create React app.

It runs on a version later than 16.8.

And that's important, you need to have React 16.8 or higher.

Otherwise you can't use React hooks.

Well, and other than that,

there's nothing special in here.

It's just a normal React application

with a couple of components I already built for you.

So let me quickly walk you through what we have here

before we start working with that

and before we start using React hooks.

With our index.js file, which is pretty trivial,

I'm importing index.css,

which sets up some global styling,

imports a font, sets up some well, global styling

for the font, for buttons, and that's it.

And then here, I render the App component,

which is living in the App.js file.

It's a very simple component.

It doesn't do much.

It will do more later,

which is why I have this extra component.

For now it just returns the Ingredients components,

which we get from the components folder,

there from the Ingredients subfolder

and then from the Ingredients.js file,

which would be this file here.

Now, in there, I, in the end, have a div.

I render a IngredientForm component,

which lives in the IngredientForm.js file.

And then I have a section

where I render the Search component,

which unsurprisingly lives in the Search.js file.

And if we have a look at the IngredientForm,

then we see that this is a component

that uses a custom Card component,

which lives in the UI folder.

We'll have a look at that folder in a second.

And then the IngredientForm here,

I do have my form here,

I have a section, which is a normal form

with a couple of inputs, two inputs to be precise

for a type and an amount

with a button and I'm also using React.memo here

to wrap this component to avoid unnecessary re-renders

so that this only re-renders, this component only re-renders

when the props it depends on changed

and not always when the parent component changed.

So not always when ingredients changed

but only when ingredients changed

and we're passing new props to IngredientForm,

which right now, we're never doing.

So right now, IngredientForm won't re-render

when Ingredients re-renders.

That's just a tiny side note.

You'll learned about React.memo earlier in the course

in the component deep dive module.

Now, that's the Ingredients folder.

Well, almost, we also have IngredientList.

There I'm just rendering a list of ingredients.

Right now we're not getting any ingredients from anywhere

and therefore, well, we're not using this.

We'll use it throughout this module, of course.

And in the Search.js file,

well, there I also use React.memo

for the same reasons I do it in the IngredientForm

and I just output a search box,

this input here in a Card.

And that's, of course, this box here at the bottom.

I've got a couple of CSS files there too.

You can, of course, go through them if you want.

Just a bit of styling to make this all look good

so that we have a nice-looking app to work with.

Now, in the UI folder, I prepared a couple

of UI components, like the Card here,

which simply wraps whatever we pass between its opening

and closing tag and gives it this nice Card look

with these styles here.

I've got the ErrorModal, which I'm right now not using

but which we will use throughout this module.

And this is just using React.Fragment.

Then I render a backdrop there in the modal itself

where we can output a custom content,

like a custom error message.

We've got a button to close that.

Clicking the backdrop should also close the modal

but it'll be up to us to wire up this logic.

I'm also using React.memo here and here I've got some styles

for that modal.

And I have a LoadingIndicator,

which is just a spinner, which we can render

to indicate that we're well, loading data.

So that is what we have here.

These are the components I'm giving you

and right now, this app doesn't do anything.

You can enter something here

but hitting this button won't do anything

because now it's up to us to wire this up.

And if you watch closely,

you'll see that all these components here,

they're all functional components.

There's not a single class-based component in there.

And we'll leave these components as functional components.

So we'll not change that

because as we'll now learn in this module,

we can build an entire React app

with just functional components with the help of hooks.

Therefore, let's dive right in

and let's learn about our first hook,

the most important hook probably.

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