Module quiz: JSX and Testing :Advanced React (Meta Front-End Developer Professional Certificate) Answers 2025
✅ MCQ Answers
1. Features of component containment
✔️ A component that acts as a generic box.
✔️ The fact that some components don’t know their children ahead of time.
✔️ A component that uses the children prop to pass children elements directly as their content.
❌ A special case of other components.
2. Props that all components have by default
✔️ children
❌ render
❌ type
3. What is a React Element?
✔️ A JavaScript object that represents the final HTML output.
❌ A React Component that represents a simple DOM node, like a button.
✔️ An intermediary representation that describes a component instance.
4. Features implemented from component composition with children
✔️ Component containment.
❌ Component specialization and containment.
❌ Component specialization.
5. Use cases of React.cloneElement API
✔️ Modify children’s properties.
✔️ Add to children properties.
✔️ Extend the functionality of children components.
6. What’s wrong in the Row implementation?
❌ Each child is missing a key
✔️ Each child is being mutated.
❌ You can’t use spread operator in style
7. What will be logged when clicking Submit?
✔️ “WithClick”
❌ “AppClick”
❌ “ButtonClick”
8. Valid solutions to encapsulate cross-cutting concerns
✔️ Components that consume context.
✔️ Render props pattern.
✔️ Higher order components.
✔️ Custom hooks.
9. What does screen represent in react-testing-library?
❌ Your laptop screen
❌ The whole page or root document
✔️ The whole virtual DOM
10. Jest matcher to assert a button is disabled
❌ toHaveBeenCalled
❌ toBeInTheDocument
✔️ toHaveAttribute
📘 Summary Table
| Q | Correct Answer(s) |
|---|---|
| 1 | Generic box ✔️, Unknown children ✔️, uses children prop ✔️ |
| 2 | children ✔️ |
| 3 | JS object ✔️, Intermediary representation ✔️ |
| 4 | Component containment ✔️ |
| 5 | Modify children ✔️, Add props ✔️, Extend functionality ✔️ |
| 6 | Child is being mutated ✔️ |
| 7 | “WithClick” ✔️ |
| 8 | Context ✔️, Render props ✔️, HOCs ✔️, Custom hooks ✔️ |
| 9 | Virtual DOM ✔️ |
| 10 | toHaveAttribute ✔️ |