practicebasic
Controlled input
An input that shows in real-time what the user types. The input value comes from state and updates with onChange. This pattern is called a 'controlled component'.
Objectives
- 1.Declare text state with empty string
- 2.Input has value={text}
- 3.onChange updates with setText(e.target.value)
- 4.Display the text below in a <p> element
your code
Hint
A controlled component has its value bound to state
Related concepts
Was this helpful?
Sign in to give feedback
