React Forms: Using Refs

Article by Loren Stewart

React provides two standard ways to grab values from <form> elements. The first method is to implement what are called controlled components and the second is to use React's ref property. The article will show you how to work with inputs, text areas, checkboxes and radio sets by using refs.


Related resources

Building forms using React — everything you need to know

Forms are integral to any modern application. They serve as a basic medium for users to interact with your app. In this tutorial, we're going to look at how React handles forms. We'll cover not just the basics, but also form validation and best practices too — even experienced developers get certain [continue]

Tutorial by Manjunath

An imperative guide to forms in React

In this tutorial, I will explain how React deals with forms and events. I'll also walk you through how to write code that helps to get input from the different form components and submit the data in a React application. Finally, I'll show how to use the Formik library to build all kinds of forms, from [continue]

Article by Yomi

How to Work with Forms in React

This article covers how to capture text input and input via other form elements like input, textarea, and option. Working with them is paramount to web development, because they allow our applications to receive data (e.g. text) and actions (e.g. clicks) from users. [continue]

Article by Azat Mardan

How to code a form in React

Learn how to create a form in React without using any libraries. Starting from scratch, I show you how to create a form component that uses local state. Additionally, it will pass data to other components allowing you to create a live preview of what the user is typing into the form. [continue]

Video Tutorial by Ben Awad