-
|
I just noticed that the setter functions return a promise, but I never await them. What's the best practice (or reasoning) here when dealing with the Promise? |
Beta Was this translation helpful? Give feedback.
Answered by
franky47
Nov 6, 2025
Replies: 3 comments 2 replies
-
|
I did a demo of this in my Next.js conf talk, where I wrap the state updater function into a |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
franky47
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I did a demo of this in my Next.js conf talk, where I wrap the state updater function into a
startTransition(async () => await setState(...))to show a pending state while the update is queued, which is useful for debounce (when the actual update gets delayed):https://youtu.be/qpczQVJMG1Y?si=JPFVH4Ih8CaSuC7N&t=998