0

I recently stumbled onto this very interesting article that might change the way I will do web form submissions in ReactJS in the future:

https://medium.com/@everdimension/how-to-handle-forms-with-just-react-ac066c48bd4f

What do you guys think of this? Is this perhaps a better way than what most people are probably doing, i.e. using controlled components?

In here, he's just using an interface called FormData which takes in the form element itself and spits out a JSON interpretation of all the input elements in the form. So it sounds like a lot less code and work for you. So IF you don't intend to use the input controls in your form for something other than sending it to the backend, why would you use controlled components???

Jon Th
  • 347
  • 2
  • 13

1 Answers1

0

I feel if the purpose is only sending it to the backend then FormData holds a strong case but in some cases if you have a component which has some dependency on form data so that the component updates with contents from the form to the component you may have to consider using controlled components.

Amit
  • 193
  • 1
  • 8