Skip to content
Advertisement

Remix useSubmit arbitrary data

I am trying to submit a form using Remix’s useSubmit hook. But I want to be able to pass arbitrary data along with my form submit data.

I have form elements with some static values that have disabled/readonly attributes, which means their value will be null on form submission. However I have access to their actual values in my post variable, which I want to send to my action.

JavaScript

Is there a way to receive custom data in my action using handleSubmit?

Advertisement

Answer

Another way to do this is

JavaScript

In this way, you are altering the original formData and adding another key to it and using that to submit the form.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement