I think Keimeno's answer best explains but the alternative provided did not work for me I found this link gives this the same idea in a different way to code: https://github.com/pmndrs/zustand/discussions/2748
import {useShallow} from 'zustand/shallow';
const [isLoading, setLoading] = useLoadingStore(useShallow((state) => [ state.loading, state.setLoading]));