Predict Controlled Input Value
Predict Output Easy
Question
After typing 'Hi', what is the input's displayed value?
Code
const [text, setText] = useState("");
return <input value={text} onChange={e => setText(e.target.value.toUpperCase())} />;
// User types "Hi" (H then i)
Hint
The onChange handler transforms the input.
Explanation
Each keystroke goes through onChange, which calls toUpperCase(). Typing 'H' shows 'H', then typing 'i' shows 'HI'. The final displayed value is "HI".
Related Resources
Related Lessons
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.