Hope you enjoyed the video! I also have a really cool and unique course that will teach you way more than this video. You'll learn how to build an actual complex project with React. It's called "Project React" and you can find it at cosden.solutions/project-react. Also, I have a free weekly newsletter called "Import React" with tutorials, news, and cool stuff about React! You can sign up at cosden.solutions/newsletter?s=ytc
@Infotainment-cb6cy2 ай бұрын
You explained nothinng const [count, setCount] = useState(0); still does not make any sense at all.
@bbbeo891210 ай бұрын
Hi Cosden, I have been working with Angular for years and now I'm learning React to enrich my skillset as a front end developer. Your videos is always concise and easy to understand that help me to save a lot of time. Thank you so much.
@CMOMKARSHELKECM4 ай бұрын
The way you teach react tells how experienced you are Keep uploading videos
@zuperhache8 ай бұрын
finally !! after watching 1000s of videos, a dude that explains! clearly how the hooks work, thank you ! 🙏💪
@huangjian774912 күн бұрын
hello、i am Chinese as a backend developer! however my english very bad!so i take you video as learning English video ❤😂
@percyk6884 Жыл бұрын
Simple, quick, and efficient, thank you!
@spongebobsquarepants45764 ай бұрын
bro, this is seriously the best explanation on youtube. Please keep them coming!
@Nelson-fw5ly Жыл бұрын
so because of useState(), I can click the 'Like' button on this video and the like counter can increment? 😆
@cosdensolutions Жыл бұрын
Hahahaha yes exactly ☺️
@bbbeo891210 ай бұрын
Then click on it again to test the decrement :)) Lol j4f don't do that haha
@Guyfromearh1Ай бұрын
But the question is how users can only do it once.
@Electro_696 ай бұрын
Daaaaamn you are a god or what, i wasted my 5 hours on this and you taught me in 10 minutes, salute man
@alowoesintoluwalase115421 күн бұрын
Thank you very much so simple to understand from you
@FursMars Жыл бұрын
You are the best teacher! Thank you for you real help and your tami and work!!!
@shortsofsomeone6 ай бұрын
Really, this was my last tutorial for using the state hook. Thanks for your effort.💗
@janemisshela6 ай бұрын
You simplified the complexity of this concept! Thanks so much!
@SandroZabakhidze2 ай бұрын
best tutorial i have se in a while
@tea21258 ай бұрын
You are an amazing teacher! Thank you!
@sgtkang22 ай бұрын
Oh my.. you explain it so well!
@priyamjain016 ай бұрын
You are a saviour my friend 🙏
@mission-DIY3 ай бұрын
I like the way you explain things that other videos do not explain, such is the naming conventions! Great work. Subscribed!
@deyonyt3 ай бұрын
really appreciate the small videos explaining big concepts so well but i think you should have talked about the asynchronous nature of useState here. in real world applications, more often than not ive gotten stumped by this async nature where the state just wont update! would really appreciate a video on that, if possible!
@cosdensolutions3 ай бұрын
fair enough, this was my first ever video though 😅
@rusliabdulgani992011 ай бұрын
the setState is tricky, cause if you do like that (setCount(count + 1) ) and when there is another async process that change the state, the value will not valid.. you should use this approach setCount(recentCount => recentCount + 1 ) it will using recent value and calculate it.
@rusliabdulgani992011 ай бұрын
so if there is any recent value involve, please make sure using this approach (using callback), rather than directly inject state
@jasonadams18765 ай бұрын
Yes, this is correct. It's nice that this video present this as simply as possible, but doing things the way it's presenting is going to set devs up for future confusion and problems.
@Thekidisalright2 ай бұрын
I was actually surprise he just use (count + 1) instead of update the count with recentCount instead
@boukrimohammed9 ай бұрын
i swear you're a life saver
@narcleptik11 ай бұрын
Thank You, you are a good teacher.
@mustafacoskun520811 ай бұрын
Thanks for clear and to the target explanation...
@richardclifford58311 ай бұрын
Very simplified explanation! Thanks!
@sarahwbas8 ай бұрын
Thank You so much! your channel is underrated!
@renejacques82889 ай бұрын
I guess you were right; I do have a better understanding of useStates now. What gets me is the word interface you used.
@alissoncamoes7113 Жыл бұрын
thank you for sharing, greetings from Brazil!
@rinshadrinshad3540 Жыл бұрын
Simple and detail Thanks For The Effort 🙌
@TheHumanistX Жыл бұрын
Enjoying your channel. Subscribed. I have seen a few times people mention (usually using this counter example) that was should do something like `setCount(prevState => prevstate + 1)` I can't remember the reasoning for this but it had something to do with the state properly updating? Do you know what I am talking about and could you disucss that? Is it needed? Why do we do this instead of just `setCount(count + 1)`?
@cosdensolutions Жыл бұрын
Doing it that way is a way to guarantee you're getting the most up to date state, which sometimes is harder to get because of how React renders work. Search examples for this online and you'll see why
@kristiankristian465211 ай бұрын
ok, yes that's a simple example, but should to mention about "prev" because an App going to be crashed once when we change many useStates in the same time.
@technologic457510 ай бұрын
Nice video but I was expecting that you could explain more about the difference between using function to set a state ex. instead of setCount(count + 1) others are using setCount(prevState => prevState + 1)
@rusliabdulgani992010 ай бұрын
cause setState function is async process, so the React do not guarantee that if you use this approach (setCount(count + 1)) it will always correct, so react give you saver approach (setCount(callback)) to make sure your function to set the state will be always correct.
@OXIDE777-is6gs Жыл бұрын
Awesome!!! please do more of those on other React subjects🙏
@cosdensolutions Жыл бұрын
Yep 🤙
@TEScompetitive Жыл бұрын
Much appreciated, best tutorial out on this
@andrewchukwudumeje94137 ай бұрын
I love the explanation bro Thanks a lot Keep up the good work
@enochdollar-bill33063 ай бұрын
made it make too much sense, i think imma watch ur playlist now
@metcaelfe4 ай бұрын
Subbed, your videos and explanations are fantastic! Thank you!
@GeraldPajulas10 ай бұрын
Thank you for this. I understand the useState now hahaha😆😆
@lll-vq6pm4 ай бұрын
Sir can you instead show us how to use useState in manipulating DOM elements or classes. That would be more helpful to us beginners who is more into designing our react apps as an aspiring frontend dev.. just suggesting thankyou for your videos ❤️
@Salah-YT Жыл бұрын
Lovely job, bro! Subscribed and liked. Please cover each hook individually and create a list, it would be awesome. Thanks a lot! 😍👍
@cosdensolutions Жыл бұрын
There's a playlist already ☺️ but yes planning to do all of them
@Scotthutchinsonking11 ай бұрын
this dude is awesome
@jabiesorenson82719 ай бұрын
Just subbed cause I like the way you describe things good job
@RobixYTT-nu4ug11 ай бұрын
Thanks for the video and for the taking the time to explain how useState works. It is so damn simple. Now, I am going to teach this to my mentees. They won't know that this is me as I am not using my real name,. hahaha! Thanks a lot!
@manushadananjaya8125 Жыл бұрын
Greetings Good luck! From Sri lanka❤
@cosdensolutions Жыл бұрын
thank you! love sri lanka :D colombo is a great city
@Adrianku11 ай бұрын
just WOW! this was really helpful! thanks! new sub here
@eunwoooscomics Жыл бұрын
I loved this video keep up the good work
@abzz129011 ай бұрын
Great. How to handle multiple or object and array in useState?
@manushadananjaya8125 Жыл бұрын
Thank you soo much this is so much better 😍
@cosdensolutions Жыл бұрын
glad you found it useful!
@kadirmemisoglu343 Жыл бұрын
I like your video but you did not mention about preVal in state. I think this is so important that you can not avoid to mention
@mazthespaz13 ай бұрын
but you didn't say how the rest of the program gets access to the count value. should the count functions broadcast messages when count has changed?
@madipallynaveenkumar68115 ай бұрын
Nice one!... Liked it!
@SR-zi1pw Жыл бұрын
Great tutorial brother
@zuperhache8 ай бұрын
by the way, what is your opinion on AI, copilot for example, Is it worth it to keep learning how to code?
@smurffronda2951 Жыл бұрын
Thank you!
@RobinsonDomingo-dy7xq7 ай бұрын
do you have tutorial that all hook can be use?
@Smartroid Жыл бұрын
can u also make a video on how react re-renders when usestate state is changed and how does useState use object.is() under the hood
@cosdensolutions Жыл бұрын
That's a bit of an advanced topic 😅 I'm still doing beginner videos so it'll take some time!
@amalikmuhd11 ай бұрын
well explained!!
@clintonboamah60298 ай бұрын
Fantastic!😉
@amalkhardli11 ай бұрын
great thank you!
@rklintwo Жыл бұрын
Solid tutorial. New subscriber here!
@ariandane7631 Жыл бұрын
Thank you. Why wouldn’t you just set a variable count and have a function that adds 1 and have the button call the function? I’m new to react and use state.
@cosdensolutions Жыл бұрын
because in React components, doing it that way wouldn't cause a re-render and your new value wouldn't show on the screen! You need state to trigger an update and then it will show!
@tufanalin7 ай бұрын
Man I feel like Luka Doncic is teaching 😂
@Adam-zg7cv7 ай бұрын
I suggest editing this video and adding an important concept. For example, why do you need the hook in the first place? I mean why don't you just use a JS variable instead? setState causes the whole component to be re-rendered. You cannot fully understand without fully understanding the component lifecycle.
@prithivirajanv8146 Жыл бұрын
hi, thanks... You are awesome... Make more videos
@cosdensolutions Жыл бұрын
Will do!
@webb-developer9 ай бұрын
what's the different between using a state and using a normal variable and reassigning it ?
@cosdensolutions9 ай бұрын
State triggers a re-render of the component so you can see the new value in the UI, variable assigning will not work consistently in React
@sheshankkumar1184 Жыл бұрын
Can you please make one video where we get to know difference between using useState hook instead of normal variables using let keyword
@cosdensolutions Жыл бұрын
you should always use state for things that you want to track and update over time. The only use case for using something like a variable without state is when you want to derive something from state. But everything should be driven from state in React
@sheshankkumar1184 Жыл бұрын
understood but what happens when i use normal variables instead of State variables? I can use them seamlessly. While using state variables I face difficulty as they require a queue to call set functions. that is not the case with normal variables.
@unucooper36024 ай бұрын
thank uuu
@avinashshiyani10 ай бұрын
Nice
@farahelaydi8474 Жыл бұрын
thank Youuu
@kaptainfreak698811 ай бұрын
thank u
@yousufrumi55874 ай бұрын
zoom in your code screen
@itxchiiiАй бұрын
whole lotta capping in the intro, the video is clear but thats not everything about useState().
@Abc-me2cx9 ай бұрын
hello
@ariyoujahan9662 Жыл бұрын
I love your videos, but i actually disliked this one. It wasn't like your other videos. Watching all those amazing video that covers every corners and addresses all edges cases made an expectation. But nuh, this wasn't one of those. Hope your create another video and address those as well. By the way thank you.
@cosdensolutions Жыл бұрын
This is my first ever video my dude ☺️
@userre857 ай бұрын
He didn't introduce the setState(prev => prev+1) syntax
@7VoltZoneАй бұрын
okay, the title said it "simply", I dont know that its really mean SIMPLE! and you said the last useState video, wich is NOPE... You just explain like 50% of useState.. what useState could do? what it used for? can you explain how to call count without arrow function? how I can check the count's current value? maybe some conditional logic? you just tell us something that already writen in the reac's docs...
@sachinkhatri10774 ай бұрын
Hello sir i have double. Why can't we use count++ instead of count + 1 ????
@shaxzodsharipov6622 Жыл бұрын
admin, i heve best offer for you . How can we talk