You explained how to use useState really well and provided a great example. I especially liked how you broke down how to lift state up and share it between components. Thank you!
Great video. You make more complicated concepts easy to digest. Question though, why not use "getter" and "setter" language when talking about useState variables?
The words "getter" and "setter" are usually used in OOP language to talk about a method that will get or set a property on an object, usually with some syntactic sugar to hide that you're calling a method. In this case, the set function acts like a setter, but it's a little weird in it's behaviour because it doesn't actually set any value, nothing we can interface with anyway. Instead it enqueues a change that will happen upon the components re render, so it's more like a "set on re render also re render er"than a simple setter. As for the getter, well it's not a getter at all, it's just the value. Nothing fancy, just a value. To call it a getter might imply that the value could be used to get the most up to date version of the state, but this is not the case. Whatever references that value on the current render will always read that value, never a new value. You can test this by trying to create a simple stopwatch app without using the updater function. TL;DR The value isn't a getter, it's just a plain ol' js value The setter is kind of like a setter but different enough that I wouldn't use "getter" and "setter" and feel ok about it
your videos are extremely underrated
You explained how to use useState really well and provided a great example. I especially liked how you broke down how to lift state up and share it between components. Thank you!
Simply WoW! Great demo of async operation and use of useState. You make the underlying concepts so much clearer. Thank you Sam..
great work
good series. thanks. dropping a comment for the yt algorithm :)))
I truley enjoyed. Adding Favorite button was exciting part🤩
Great video. You make more complicated concepts easy to digest. Question though, why not use "getter" and "setter" language when talking about useState variables?
The words "getter" and "setter" are usually used in OOP language to talk about a method that will get or set a property on an object, usually with some syntactic sugar to hide that you're calling a method. In this case, the set function acts like a setter, but it's a little weird in it's behaviour because it doesn't actually set any value, nothing we can interface with anyway. Instead it enqueues a change that will happen upon the components re render, so it's more like a "set on re render also re render er"than a simple setter. As for the getter, well it's not a getter at all, it's just the value. Nothing fancy, just a value. To call it a getter might imply that the value could be used to get the most up to date version of the state, but this is not the case. Whatever references that value on the current render will always read that value, never a new value. You can test this by trying to create a simple stopwatch app without using the updater function.
TL;DR
The value isn't a getter, it's just a plain ol' js value
The setter is kind of like a setter but different enough that I wouldn't use "getter" and "setter" and feel ok about it
I agree with everything you’re saying BUT you’re being too… what’s that word? Pedantic.
Yes! You’re welcome 🤗🤗🤗🤗
thanks 🔥
{2023-07-10}