UI delay
Unanswered
Dutch Smoushond posted this in #help-forum
Dutch SmoushondOP
I have a like button for posts but when pressed has a slight delay, is there a way to have the ui update and have the backend update slightly after?
4 Replies
If your like button is calling a server action directly to update the backed, you can either:
- utilize the new
- Utilize the
- utilize the new
useOptimisticState hook to update the UI instantly and let the server action go through whenever, or- Utilize the
useTransition/React.startTransition functionality to update client state without waiting blocking the rendenring (this might very well work/not-work depending on your exact scenario)