Комментарии:
Hats off to your valuable brain.
Ответить❤❤❤
Ответить❤❤
ОтветитьHow do I set state in a loop?
For example a loop that has a save button of every record on clicking would be saved true.
On setting the set state , it changes the state as saved to every single record instead of the one that was clicked.
Keep up the good work!
Ответитьbeen looking for a good explaination on why to use prevState for a while and this is it!! :) thanks alot.
ОтветитьThank you...
ОтветитьThanks Tom, mad that the setCount function can either take a number or a function.
ОтветитьYou are GOD! I had a similar issue. thank you thank you very much
ОтветитьGreat 👌
ОтветитьSaved my project 🙂. Thanks a lot.
Ответить🤯
Ответитьnice video!
ОтветитьHow come setTimeout() pass the argument before it fires setCount?
ОтветитьTry catch and learn, right?
ОтветитьJust discovered the "set" function pattern your showing here, can be really useful in some async scenarios!
It's a "gotcha" that you have to persist any events etc. if you'r just using it to capture a form value update for example. Since by the time your set lambda runs the event has been reused.
So I guess in those scenarios it's still preferable to just use the updateValue({name: e.target.value}) directly so you don't have to persist? Guess it's not a one size fits all here but...
Spagetti style function declaration withing function body is somewhat oldstyle no?
()=>{ function callback(){ function nestedCallback(){ }}} etc etc....
Aren't you suppose to use useCallback to handle that kind of scenario?
Thnx for sharing!
Great, looks like I made such errors earlier, thank you for make it clear
ОтветитьThank for this tip Tom, this is good to know.
Ответить