- ReactJS - Discussion
- ReactJS - Useful Resources
- ReactJS - Quick Guide
- ReactJS - Example
- ReactJS - Building and Deployment
- ReactJS - CLI Commands
- ReactJS - Testing
- ReactJS - Animation
- ReactJS - Redux
- ReactJS - Routing
- ReactJS - Form programming
- ReactJS - Http client programming
- ReactJS - State Management
- ReactJS - Event management
- ReactJS - Properties (props)
- ReactJS - Styling
- ReactJS - Components
- ReactJS - JSX
- ReactJS - Creating a React Application
- ReactJS - Architecture
- ReactJS - Installation
- ReactJS - Introduction
- ReactJS - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
ReactJS - Form Programming
The nature of form programming needs the state to be maintained. Because, the input field information will get changed as the user interacts with the form. But as we learned earper, React pbrary does not store or maintain any state information by itself and component has to use state management api to manage state. Considering this, React provides two types of components to support form programming.
Controlled component − In controlled component, React provides a special attribute, value for all input elements and controls the input elements. The value attribute can be used to get and set the value of the input element. It has to be in sync with state of the component.
Uncontrolled component − In uncontrolled component, React provides minimal support for form programming. It has to use Ref concept (another react concept to get a DOM element in the React component during runtime) to do the form programming.
Let us learn the form programming using controlled as well as uncontrolled component in this chapter.