Bird
0
0

Which approach best follows Angular container and presentational component patterns?

hard📝 Application Q15 of 15
Angular - Advanced Patterns
You want to create a container component that fetches a list of products and passes it to a presentational component for display. Which approach best follows Angular container and presentational component patterns?
AContainer fetches products, stores in a variable, passes via <code>@Input()</code>; presentational only displays list
BPresentational component fetches products and emits events to container
CContainer and presentational both fetch products independently
DPresentational component manages fetching and state internally
Step-by-Step Solution
Solution:
  1. Step 1: Identify container responsibility

    The container should handle fetching data and managing state.
  2. Step 2: Identify presentational responsibility

    The presentational component should only display data received via @Input() without fetching or managing state.
  3. Final Answer:

    Container fetches products, stores in a variable, passes via @Input(); presentational only displays list -> Option A
  4. Quick Check:

    Container = data fetch, Presentational = display [OK]
Quick Trick: Container fetches data, presentational displays it [OK]
Common Mistakes:
  • Letting presentational fetch data
  • Duplicating data fetch in both components
  • Mixing data logic inside presentational

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes