
MCP is the bridge between AI and the open web — giving intelligent agents the ability to act, not just talk. Here’s how this open protocol transforms development, business models, and the future of software itself.

AI agents can now log in, act, and access data, but have you truly authorized them? This guide walks through how to secure your autonomous agents using Auth0’s Auth for GenAI, covering token vaults, human-in-the-loop approvals, and fine-grained access control.

A hands-on guide to building an FTC-ready chatbot: real age checks, crisis redirects, parental consent, audit logs, and usage limits – designed to protect minors and prevent harm.

CSS text-wrap: balance vs. text-wrap: prettyCompare and contrast two CSS components, text-wrap: balance and text-wrap: pretty, and discuss their benefits for better UX.
Would you be interested in joining LogRocket's developer community?
Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.
Sign up now
13 Replies to "Creating forms in React in 2020"
Nice post, wish when I read all these forms in react blogs though that they’d include nice ways the include validation
Great article 👍
There is a small typo in the first example. You entered username.. probably ment email
Coulda mentioned somewhere that you’re using typescript. Cheers.
I think, the approach you used for get data using FormData, it’s antipattern in react. Please see controlled components vs uncontrolled components.
I feel you – but validation in React is a huge topic by itself. I typically start out with using HTML5’s form validation. If you need more customization, I wrote an article series about how you can write your own validation logic: https://www.smashingmagazine.com/2019/05/react-validation-library-basics-part1/
If Formik is a great library, as is react-form-hook. Best of luck!
I believe your useFormFields example isn’t working that way…
You missed submit button in the first example.
Hi Oleg! `type=”submit”` is the default for components, so you don’t have to specify it explicitly
I think what the author is trying to say throughout the article is that in simple cases, the overhead of controlled components doesn’t bring any additional benefits. Just using uncontrolled components alone isn’t an anti pattern.
Awesome! great explanation (L)
Hi ,
I use a custom hook, but the problem is that I also have a large list in the component. When I do the onChange operation, this list becomes re render again and greatly reduces performance.
Your code works fine until a checkbox is added. The formData doesn’t seem to return a true/false value.
const formData = new FormData(e.target as HTMLFormElement);
The formData.get(‘registerMe’) returns ‘on’ instead of true/false. I cannot think of any other way except to access the checkbox value directly:
e.target.elements[‘registerMe’].checked
So wouldn’t it be better to access the elements directly rather than through the FormData? You already have a reference to the form and can access the values.
Awesome write up. Be nice if it was not typescript though.