Y
Hacker News
new
|
ask
|
show
|
jobs
by
steve_taylor
2386 days ago
I had no idea the setter can take a function instead of a value. It makes perfect sense, because setState has the same feature. TIL.
1 comments
acemarke
2385 days ago
FWIW, it's documented in the API reference:
https://reactjs.org/docs/hooks-reference.html#functional-upd...
link
https://reactjs.org/docs/hooks-reference.html#functional-upd...