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
It fails to compile because, as per the useActionState docs,
useActionState(action, initialState, permalink?)
the "action" (requestUsername in this case) should have previousState as the first argument,
and formData as the second argument.
However, for the above example, the requestUsername action has formData as the first argument,
rather than previousState. Therefore, it fails to compile.
The following is the correct way mentioned in the useActionState docs:
Summary
The following example is given in Handling return values in forms section for "use server" docs, fails to compile.
Page
https://react.dev/reference/rsc/use-server#handling-return-values
Details
It fails to compile because, as per the useActionState docs,
the "action" (
requestUsername
in this case) should havepreviousState
as the first argument,and
formData
as the second argument.However, for the above example, the
requestUsername
action hasformData
as the first argument,rather than
previousState
. Therefore, it fails to compile.The following is the correct way mentioned in the useActionState docs:
I can raise a PR for the fix, if it's okay.
The text was updated successfully, but these errors were encountered: