Make Basic Forms with React

Share this video with your friends

Send Tweet

Forms are a basic building block of the web. Every web application uses form elements as a way to accept input from the user. There are a few things to keep in mind with how forms work on the web and in this lesson we’ll learn about those as well as various ways you can retrieve values from elements in the form as well as a few best practices you should consider when working with form elements on the web.

You can learn more about basic forms in the React documentation about Uncontrolled Components.

Quang Le
Quang Le
~ 5 years ago

Thank you for the explanation about the HTML form and the advice of how to use it properly. I just have a question regarding to the ID of the input element. Will it cause the confliction if there is another similar form on the page? Since the form can be extracted to be on a component and if it is reused, then there are duplication of element's IDs. If so, what is better way to resolve it? Thanks.

Kent C. Dodds
Kent C. Dodds(instructor)
~ 5 years ago

Yes, you will want to ensure the ID is unique across the page. You can definitely generate it though. I think the best implementation of something like this is useId from Reach UI: https://reacttraining.com/reach-ui/auto-id/

Quang Le
Quang Le
~ 5 years ago

Thank you very much for your prompt response and solution.

~ 2 years ago

Hey! Great Lesson, but I've found a small issue :) 1:36-1:40 - The browser is automatically making a GET request, not POST, but I guess that is just a blunder.