我们知道在使用zustand的时候,可以配置多个Slice,
export const createAModuleSlice: StateCreator<AModuleSlice> = (set, get) => ({
aList: [],
action1: () = > {
},
action2: () = > {
// get可以获取本Slice中定义的变量或方法
},
})
export const createBModuleSlice: StateCreator<BModuleSlice> = (set, get) => ({
bList: [],
action1: () = > {
},
action2: () = > {
// get可以获取本Slice中定义的变量或方法
},
})
请问下,是否可以在BModuleSlice中通过get获取AModuleSlice中的变量和方法呢?
用 combine 方法组合 Slices: