0
0
Angularframework~5 mins

Smart and dumb component pattern in Angular - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a smart component in Angular?
A smart component manages data and logic. It fetches data, handles user actions, and passes data to dumb components. Think of it as the brain controlling the app's behavior.
Click to reveal answer
beginner
What is a dumb component in Angular?
A dumb component only displays data and emits events. It does not manage data or logic. It’s like a simple display or form that relies on smart components for data.
Click to reveal answer
intermediate
Why use the smart and dumb component pattern?
It separates concerns: smart components handle logic and data, dumb components handle UI. This makes code easier to read, test, and reuse, like having a manager and workers each with clear jobs.
Click to reveal answer
intermediate
How do smart and dumb components communicate in Angular?
Smart components pass data to dumb components using @Input properties. Dumb components send events back using @Output EventEmitters. This is like sending messages back and forth clearly.
Click to reveal answer
beginner
Give an example of a dumb component's responsibility.
A dumb component might show a list of items and emit an event when an item is clicked. It does not fetch or change the list, just shows it and tells the smart component what happened.
Click to reveal answer
What is the main role of a smart component?
AOnly display UI without logic
BManage data and business logic
CEmit events without receiving data
DStyle the application
How does a dumb component receive data from a smart component?
AUsing Angular routing
BUsing @Output EventEmitters
CDirectly accessing services
DUsing @Input properties
Which of the following is NOT a characteristic of dumb components?
ADisplay data
BEmit user events
CFetch data from APIs
DHave no business logic
Why is separating smart and dumb components helpful?
AImproves code clarity and reuse
BMakes components bigger
CRemoves the need for services
DAvoids using Angular directives
How do dumb components notify smart components about user actions?
AUsing @Output EventEmitters
BUsing @Input properties
CBy calling smart component methods directly
DBy changing global variables
Explain the difference between smart and dumb components in Angular.
Think about who controls data and who just shows it.
You got /4 concepts.
    Describe how smart and dumb components communicate and why this pattern is useful.
    Consider the flow of data and events between components.
    You got /4 concepts.