Loading

Quipoin Menu

Learn • Practice • Grow

react / Component Composition in React
mcq
Direction: Choose the correct option

Q1.

What is component composition in React?
A. Using inheritance to extend components
B. Combining multiple components to build a complex UI
C. Styling components together
D. Writing components in a single file
Direction: Choose the correct option

Q2.

Which prop is commonly used to pass children elements to a component?
A. child
B. content
C. elements
D. children
Direction: Choose the correct option

Q3.

Consider this code:

Hello

. How does Card access

Hello

?
A. Via a render prop
B. It cannot
C. Via props.children
D. Via props.content
Direction: Choose the correct option

Q4.

What is the advantage of composition over inheritance?
A. It enforces strict hierarchies
B. It makes code less reusable
C. It allows more flexible and reusable component structures
D. It reduces the number of components
Direction: Choose the correct option

Q5.

Which pattern involves passing a function as a child to control rendering?
A. Render props
B. Context
C. Higher-order component
D. Compound component