我是完全新的zustand,我很想知道是否有可能作出改变,以一个商店从内部的另一个?如果是,请完成修改increasePopulation函数,使其也增加forestStore中的动物。谢啦,谢啦
const bearStore = create((set) => ({
bears: 0,
increasePopulation: () => set((state) => ({ bears: state.bears + 1 })),
//should also increase animals count in forestStore
}))
const forestStore = create((set) => ({
animals: 0,
}))
字符串
1条答案
按热度按时间bq9c1y661#
字符串