Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumReactglobal state Zustand ReduxSingle-choice MCQ

Using Redux Toolkit, a component selects `state.items.filter(i => i.active)` directly inside `useSelector`. Even when nothing relevant changed, the component re-renders on every dispatch anywhere in the store. What is the actual cause, and the idiomatic fix?

const active = useSelector((state) => state.items.filter((i) => i.active));