Commit 3ea0999
committed
docs: clarify when updater functions are needed for useState
The existing DeepDive overstated the guarantee that state is always
up-to-date before the next user action. This is not true when the state
variable has been updated inside a Transition elsewhere in the app, or
when multiple updates happen in the same event handler.
Restructure to present both cases together and contrast the two
approaches (reading the state variable vs. using an updater).1 parent 6ec6134 commit 3ea0999
1 file changed
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
324 | 324 | | |
325 | | - | |
| 325 | + | |
326 | 326 | | |
327 | | - | |
| 327 | + | |
| 328 | + | |
328 | 329 | | |
329 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
330 | 333 | | |
331 | 334 | | |
332 | 335 | | |
| |||
0 commit comments