// Why does my Zustand counter render on a theme change? // Teaching excerpts; see the explanation and boundaries on the episode page. // You subscribed to the whole store. const state = useStore(); const { count } = state; // Select the value you actually use. const count = useStore( state => state.count ); // Need several values together? import { useShallow } from "zustand/react/shallow"; const pair = useStore(useShallow( s => ({ count: s.count, add: s.add }) ));