Form React
i see ppl use useState hook when creating forms
why would i need it for
except for running validation on each input seperatly
what is the drawback of using the FormData class
2 Replies
It's a core part of React that forms are controlled components , where the values are handled and saved in state , helps create one source of truth, access to the values for conditional rendering or styles , simpler validation etc
Obviously we often have a <form> with more inputs , so this is just a quick example of a common pattern
i get it that this is how it works my idea is
this adds compelxity unless you must control an input field there is no justified use for the useState for each input