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
According to the types as defined in FormHTMLAttributes (in react/index.d.ts), the action property ((formData: FormData) => can only either return a void or a Promise<void>. By adding a return object as indicated in the "Reveal the Solution" sections, it breaks next build because the typing is invalid.
I believe these actions are expecting not to actually return anything, hence the errors. I had to change my code to instead throw a new Error and console.error rather than returning { message: 'Whatever message to return here' } in order to fix my builds.
I don't know if this is something that changed as of React v19.0 stable or not, but returning an object appears to no longer be supported.
The text was updated successfully, but these errors were encountered:
Digging further into Chapter 14, I think the issue is that the addition of the {message: string} response is being added too early. Once you start using useActionState, then the expected response changes to be able to accept a response object from the form actions.
According to the types as defined in FormHTMLAttributes (in react/index.d.ts), the action property
((formData: FormData) =>
can only either return avoid
or aPromise<void>
. By adding a return object as indicated in the "Reveal the Solution" sections, it breaksnext build
because the typing is invalid.I believe these actions are expecting not to actually return anything, hence the errors. I had to change my code to instead throw a new Error and console.error rather than returning
{ message: 'Whatever message to return here' }
in order to fix my builds.I don't know if this is something that changed as of React v19.0 stable or not, but returning an object appears to no longer be supported.
The text was updated successfully, but these errors were encountered: