Recall & Review
beginner
What is inheritance in component design?
Inheritance means creating a new component by extending an existing one, so the new component gets all features of the old one plus some new ones.
Click to reveal answer
beginner
What is composition in component design?
Composition means building components by combining smaller components together, like putting Lego blocks to make a bigger model.
Click to reveal answer
intermediate
Why is composition preferred over inheritance in Next.js?
Composition is preferred because it keeps components simple, reusable, and easier to understand. It avoids complex chains of inheritance that can be hard to manage.
Click to reveal answer
beginner
Give an example of composition in Next.js components.
Using a
Button component inside a Card component is composition. The Card 'composes' the Button to build its UI.Click to reveal answer
intermediate
What problem can inheritance cause in UI components?
Inheritance can create tight coupling and complex hierarchies, making components hard to change or reuse without affecting others.
Click to reveal answer
Which approach is like building with Lego blocks in Next.js?
✗ Incorrect
Composition combines small components to build bigger ones, just like Lego blocks.
What does inheritance do in component design?
✗ Incorrect
Inheritance extends an existing component to add or change features.
Why might inheritance be less ideal in Next.js components?
✗ Incorrect
Inheritance can cause complex chains that are hard to maintain.
Which is a benefit of composition?
✗ Incorrect
Composition encourages simple, reusable components.
In Next.js, how do you usually combine UI pieces?
✗ Incorrect
Next.js favors composing smaller components to build UI.
Explain the difference between composition and inheritance in Next.js component design.
Think about how Lego blocks (composition) differ from copying and changing a whole block (inheritance).
You got /4 concepts.
Describe why composition leads to more reusable and maintainable components in Next.js.
Consider how building with small pieces helps you swap or fix parts easily.
You got /4 concepts.