State Management · Middle · Question 20 of 75
Why does this component re-render on every store change?
const { count, inc } = useStore();- ✓Correct answer: Without a selector it subscribes to the whole store
- 2Destructuring is forbidden for Zustand hooks
- 3Actions in the store are recreated on every update
Explanation
useStore() returns the whole state object, so any change re-renders the component. Select what you need: useStore((s) => s.count) and useStore((s) => s.inc).