Textarea: Same Pattern, Different Element
You'll learn that controlled textareas work identically to text inputs—just a different HTML element with the same value and onChange pattern.
The Same Pattern, New Tag
In regular HTML, <textarea> behaves differently from <input>: it holds its content between opening and closing tags (<textarea>Default text here</textarea>). But React simplifies this inconsistency.
In React, <textarea> works exactly like a controlled text input. You use the value prop (not children) and the onChange handler, making the pattern completely consistent:
function CommentForm() {
const [comment, setComment] = useState('');
return (
<textarea
value={comment}
onChange={(e) => setComment(e.target.value)}
/>
);
}
Why React Chose This Design
React deliberately made <textarea> behave like <input> to give you a uniform controlled component pattern. Whether you're handling a single-line text input or a multi-line textarea, you write the same code structure. This consistency reduces mental overhead and prevents bugs.
The only visual difference is that textareas allow multiple lines and typically render larger. But the state management logic? Identical.
Setting Initial Content
Since value controls the textarea's content, set initial text through your state's default value:
const [bio, setBio] = useState('Tell us about yourself...');
Don't put content between <textarea> tags—React ignores it in controlled mode.
Key Takeaway: <textarea> in React uses the exact same value + onChange controlled pattern as text inputs, creating a consistent mental model across all text-based form elements.