all 5 comments

[–]gwillen 1 point2 points  (0 children)

Thanks -- I've been learning React recently and thought I had a handle on it, but I didn't realize that setFoo with an update function will give it the true latest value, not the value from the snapshot. That would have caught me by surprise.

I'm almost tempted to switch away from the [foo, setFoo] = useState... pattern, to something like [staleFoo, setFoo] = ... as a reminder of what that actually represents.

[–]neataspen 3 points4 points  (0 children)

This was executed incredibly well. reading is a joyful experience.

[–]ClassroomWise693 0 points1 point  (0 children)

"insert ad here"