Unverified Commit 5e9b5e5d authored by Shu Ding's avatar Shu Ding Committed by GitHub

Update example of Server Actions HoC (#51299)

Currently the Server Action function with `"use server"` must be an
async function as it's required by the compiler, even if it returns a
promise already.
parent c3e2999f
...@@ -480,7 +480,7 @@ export const action = withValidate((data) => { ...@@ -480,7 +480,7 @@ export const action = withValidate((data) => {
```js filename="lib/form-validation.js" ```js filename="lib/form-validation.js"
export function withValidate(action) { export function withValidate(action) {
return (formData: FormData) => { return async (formData: FormData) => {
'use server' 'use server'
const isValidData = verifyData(formData) const isValidData = verifyData(formData)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment