You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i found some bugs when i run the demo of useOptimistic. The result of list always show the final value instead of all my input value if i input quickly.
Then i awared of why the result like this. Because the function of sendMessages isn't right. async function sendMessage(formData) { const sentMessage = await deliverMessage(formData.get("message")); **setMessages([...messages, { text: sentMessage }]);** }
it should be like below: setMessages((messages) =>[...messages,{text:sentMessage}] )
i hope to get reply, thanks
The text was updated successfully, but these errors were encountered:
i found some bugs when i run the demo of useOptimistic. The result of list always show the final value instead of all my input value if i input quickly.
Then i awared of why the result like this. Because the function of sendMessages isn't right.
async function sendMessage(formData) { const sentMessage = await deliverMessage(formData.get("message")); **setMessages([...messages, { text: sentMessage }]);** }
it should be like below:
setMessages((messages) =>[...messages,{text:sentMessage}] )
i hope to get reply, thanks
The text was updated successfully, but these errors were encountered: