As soon as we start building a real application with React, we need to interact with the users. If we want to ask for information from our users within the browser, forms are the most common solution. Due to the way the library works and its declarative nature, dealing with input fields and other form elements is non-trivial with React, but as soon as we understand its logic, it becomes clear.
Forms
Uncontrolled components
Let's start with a basic example—displaying a form with an input field and a Submit button.
The code is pretty straightforward:
const Uncontrolled = () => (
<form>
<input type="text" />
<button>Submit</button>
</form>
);
If we...