Controlled Component

A controlled component is a form input whose value is driven by React state rather than the DOM. The input shows the state value, and an onChange handler…