Skip to content

Commit

Permalink
Fix 'optimistically updating form data' demo bug (#7646)
Browse files Browse the repository at this point in the history
This is the exact same fix as #6422 as the example is duplicated between the useOptimistic and <form> pages.
  • Loading branch information
subliun authored Feb 22, 2025
1 parent dcaf07e commit fc29603
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/content/reference/react-dom/components/form.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export default function App() {
]);
async function sendMessage(formData) {
const sentMessage = await deliverMessage(formData.get("message"));
setMessages([...messages, { text: sentMessage }]);
setMessages((messages) => [...messages, { text: sentMessage }]);
}
return <Thread messages={messages} sendMessage={sendMessage} />;
}
Expand Down

0 comments on commit fc29603

Please sign in to comment.