Bird
0
0

You want to create a smart component that fetches user data and passes it to a dumb component for display. Which approach best follows the smart and dumb component pattern?

hard📝 Application Q8 of 15
Angular - Advanced Patterns
You want to create a smart component that fetches user data and passes it to a dumb component for display. Which approach best follows the smart and dumb component pattern?
ASmart component fetches data, stores it in a property, and passes it via @Input to dumb component.
BDumb component fetches data directly and manages state internally.
CSmart component passes a service instance to dumb component to fetch data.
DDumb component fetches data and emits events to smart component to update UI.
Step-by-Step Solution
Solution:
  1. Step 1: Identify responsibilities

    Smart components handle data fetching and state; dumb components handle display.
  2. Step 2: Match options to pattern

    Smart component fetches data, stores it in a property, and passes it via @Input to dumb component. matches this: smart fetches and passes data via inputs. Others violate pattern roles.
  3. Final Answer:

    Smart component fetches data, stores it in a property, and passes it via @Input to dumb component. -> Option A
  4. Quick Check:

    Smart fetches; dumb displays [OK]
Quick Trick: Smart fetches data; dumb displays it [OK]
Common Mistakes:
  • Letting dumb components fetch data
  • Passing services as inputs
  • Reversing component responsibilities

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes