controlled and uncontrolled components in react example
// controlled
- In a controlled component, form data is handled by a React component.
// uncontrolled
- The alternative is uncontrolled components, where form data is handled
by the DOM itself. To write an uncontrolled component, instead of
writing an event handler for every state update, you can use a ref
to get form values from the DOM.