JSX Render Output
Predict Output Beginner
Question
What does this code print?
Code
const el = <h1>Hello {1 + 2}</h1>;
console.log(el.props.children);
Hint
JSX embeds expressions in curly braces.
Explanation
In JSX, {1 + 2} is evaluated as an expression and produces 3. The h1 element children become "Hello 3". el.props.children gives the children of the element.
Related Resources
Related Lessons
- JSX Basics
Learn JSX.
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.