React TutorialLesson 31Free preview
React Textarea
This lesson is part of React · All levels
Summary
The textarea elements in React follow the same controlled component pattern, i.e. the attribute value is bound to the state and changed by onChange. Unlike HTML, the initial content of a textarea is written through value, not text between its tags. With this pattern, it's easy to validate and store.
Key points
- Textarea uses value that refers to state
- OnChange updates the state for each text change
- Attributes rows set the initial high of the textarea
- Do not put child text in the textarea tag when it is controlled
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.