SolidJSS
SolidJSโ€ข2y agoโ€ข
4 replies
ChrisThornham

Is It Possible To Pass An Extra Parameter To A Form Action?

I'm trying to do this:

const userId = getUserId();

return (
  <form action={deleteUser(userId) method="post">
    <button>Delete User</button>
  </form>
);


Here's the action:

export const deleteUser = action(async (userId: string) => {
  await auth.deleteAccount(userId);
});


I keep getting the following errors on the "action" of the form:

Type 'Action<[userId: string], void>' is not assignable to type 'string | SerializableAttributeValue | undefined'.ts(2322)

The expected type comes from property 'action' which is declared here on type 'FormHTMLAttributes<HTMLFormElement>'

(property) JSX.FormHTMLAttributes<HTMLFormElement>.action?: string | JSX.SerializableAttributeValue | undefined
Was this page helpful?