Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: encType on Form does not include "application/json" #11337

Closed
binaryartifex opened this issue Mar 10, 2024 · 1 comment
Closed

[Bug]: encType on Form does not include "application/json" #11337

binaryartifex opened this issue Mar 10, 2024 · 1 comment
Labels

Comments

@binaryartifex
Copy link

What version of React Router are you using?

18.2.0

Steps to Reproduce

  1. Create just a simple Form component, imported from the react-router library.
  2. Observe that of all the options provided when choosing an encType, application/json is not provided.

Expected Behavior

To be able to set the encType on my Form to "application/json"

Actual Behavior

The encType property within the SubmitOptions type is of type FormEncType. This type also includes the "application/json" type. However for some reason this option does not propagate to a react router Form.

@brophdawg11
Copy link
Contributor

This is by design because the <Form> component is intended to progressively enhance <form> and be able to fallback to a working version when JS is disabled - and <form> doesn't support application/json. By using application/json you're making the choice that your app will not work without/before JS (which is a fine decision if needed!) - but you then just need to do it via the JS-required API of onClick/submit.

@brophdawg11 brophdawg11 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants