Fix code example in React-19 useOptimistic section (#6781)

should assign the result of updateName

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
This commit is contained in:
Josh Story
2024-04-25 14:11:45 -07:00
committed by GitHub
parent 0078b50894
commit 317dcf371a

View File

@@ -211,7 +211,7 @@ function ChangeName({currentName, onUpdateName}) {
const submitAction = async formData => {
const newName = formData.get("name");
setOptimisticName(newName);
await updateName(newName);
const updatedName = await updateName(newName);
onUpdateName(updatedName);
};