>

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

Redux Architecture — Reducers, Selectors, and the AppState Shape

Question 1 / 1

0:00
Core
Medium

A getFilteredProducts selector is created with createSelector and called in readState(). The state has 500 products and the filter computation is expensive. On a keypress in an unrelated search box, the store dispatches a [UI] Search Term Changed action that only updates state.ui.searchTerm. Does getFilteredProducts recompute its result?

typescript export const getFilteredProducts = createSelector( getAllProducts, // reads state.products.entities getActiveFilters, // reads state.products.filters (products, filters) => products.filter(p => matchesFilters(p, filters)) );