How do you handle component state in a Redux store?
React Intermediate Questions - Set 4
Example
1
2
3
// Redux: component state lives in the store, not in the component
const items = useSelector(s => s.cart.items);
dispatch({ type: 'cart/add', payload: item });
What to notice
Local UI state (open/closed) stays in the component; shared domain state goes to the store.