Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
All right, that is clear, but as you're looking at our setup, you're probably wondering, OK, but
why do we have to even bother with an object in the first place?
Can we set up three separate state values and then whichever we would want to change, of course, we
would use that handler method.
Well, let's try it out.
But I can right away spare you the cliffhanger and said, yeah, that is essentially what you can do.
So in here I'm going to go name and set name.
So I'm going to be somewhat original where I'm not going to go with a wild name for my handler function.
And then again, I'm looking for the same thing, Peter, and then I'll just copy and paste and will
change these values around where now we have age and then we're looking for a set edge and the value
will be 24.
And then the last one, of course, is going to be my message.
So we're going message set message.
That is going to be my function online.
As far as the original value.
When we passed in here, we set random message.
Now, of course, in this case, we are not dealing with objects anymore.
So we have these state values.
So one by one, of course, we will need to access them.
So now I'm looking for a name that I'm looking for a person.
And then lastly, I'm looking for a message.
And when we talk about this change message, well, we can either right away call set message here on
click.
So remember that, of course, we'll have to set up the in line because we're passing in the argument
or since we already have the handler, I can simply pass here and say set and then message and we would
want to change it, of course, to a analog world.
So once we set that up.
Now, once you click course, I have my value.
So essentially what I'm trying to say that there is no rule that prevents you from setting up as many
state values as you would want.
So instead of going for one giant object, you can set up multiple smaller state values where you have
just a single value and a function that controls it.
Or if you do decide, going with an object.
And there's going to be some use cases where object might make a little bit more sense than always,
always, always.
Remember that you need to make sure that you preserve these old values.
And a nifty way of doing that is using a separate operator where essentially we copy the properties
from the previous object and then we just choose whichever we would want to override.
And of course, in this case it was a message.
So we went from random message to a hell of world power.
Yes, there is an alternative where you can set up as many state values as you would want just by calling
your state.
You state passing in default value and then you have that single state value as well as the handler
function for that step value.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.