Object Props Spread
Predict Output Easy
Question
What does this code print?
Code
function App() {
const props = { a: 1, b: 2 };
return <Child {...props} />;
}
// Child receives?
Hint
Spread operator passes all object properties as props.
Explanation
{...props} spreads the object, equivalent to a={1} b={2}. Child receives props.a=1 and props.b=2.
Related Resources
Related Lessons
- Props
Learn props.
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.