From c571761578f8301fc4279b61c2be9b1da701f696 Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Wed, 24 Apr 2024 13:36:12 -0400 Subject: [PATCH 1/3] move useFormState api --- ...t-we-have-been-working-on-february-2024.md | 4 +- .../reference/react-dom/components/form.md | 12 ++--- .../reference/react-dom/hooks/index.md | 4 +- src/content/reference/react/hooks.md | 1 + src/content/reference/react/use-server.md | 8 ++-- .../useActionState.md} | 48 +++++++++---------- src/sidebarReference.json | 10 ++-- 7 files changed, 42 insertions(+), 45 deletions(-) rename src/content/reference/{react-dom/hooks/useFormState.md => react/useActionState.md} (72%) diff --git a/src/content/blog/2024/02/15/react-labs-what-we-have-been-working-on-february-2024.md b/src/content/blog/2024/02/15/react-labs-what-we-have-been-working-on-february-2024.md index 03fc85c37fd..04aff7afc86 100644 --- a/src/content/blog/2024/02/15/react-labs-what-we-have-been-working-on-february-2024.md +++ b/src/content/blog/2024/02/15/react-labs-what-we-have-been-working-on-february-2024.md @@ -52,7 +52,7 @@ We refer to this broader collection of features as simply "Actions". Actions all ``` -The `action` function can operate synchronously or asynchronously. You can define them on the client side using standard JavaScript or on the server with the [`'use server'`](/reference/react/use-server) directive. When using an action, React will manage the life cycle of the data submission for you, providing hooks like [`useFormStatus`](/reference/react-dom/hooks/useFormStatus), and [`useFormState`](/reference/react-dom/hooks/useFormState) to access the current state and response of the form action. +The `action` function can operate synchronously or asynchronously. You can define them on the client side using standard JavaScript or on the server with the [`'use server'`](/reference/react/use-server) directive. When using an action, React will manage the life cycle of the data submission for you, providing hooks like [`useFormStatus`](/reference/react-dom/hooks/useFormStatus), and [`useActionState`](/reference/react/useActionState) to access the current state and response of the form action. By default, Actions are submitted within a [transition](/reference/react/useTransition), keeping the current page interactive while the action is processing. Since Actions support async functions, we've also added the ability to use `async/await` in transitions. This allows you to show pending UI with the `isPending` state of a transition when an async request like `fetch` starts, and show the pending UI all the way through the update being applied. @@ -78,7 +78,7 @@ React Server Components, Asset Loading, Document Metadata, and Actions have all - **Asset Loading**: we integrated Suspense with the loading lifecycle of resources such as stylesheets, fonts, and scripts so that React takes them into account to determine whether the content in elements like [`