>

CODEMASTERYLAB

IDE PLATFORM
CoursesCommunity BlogsKnowledge GraphQuizzesInterview Prep

Sign in to track progress & earn XP

Sign In Create Account
>
Code Mastery Lab

Code Mastery Lab

Sign In

Container vs. Presentational Components — Scaling Redux Cleanly

Question 1 / 1

0:00
Core
Medium

A ProductCardComponent is used in three places: a product list page, a search results page, and a recommendations widget. A developer adds @Inject(AppStore) to its constructor to dispatch a [Cart] Add Item action when the user clicks 'Add to Cart'. What problem does this create?

typescript @Component({ selector: 'app-product-card' }) export class ProductCardComponent { @Input() product: Product;

constructor(@Inject(AppStore) private store: Store<AppState>) {}

addToCart(): void { this.store.dispatch(addToCart(this.product)); } }