Next.js Discord

Discord Forum

useFormState initialValue overload error

Answered
Arinji posted this in #help-forum
Open in Discord
 const initialState = {
    type: "success",
    message: "",
    id: data.id,
  };

  const [state, formAction] = useFormState(DeleteSubTodoAction, initialState);


Argument of type '{ type: string; message: string; id: number; }' is not assignable to parameter of type 'void

Why would initial state be void :/
Answered by Arinji
oh my action has to return state.....
View full answer

1 Reply

oh my action has to return state.....
Answer