Commit cb25fae
committed
docs(changeset): - Support for Zustand-style **slice composition** via
- Now you can structure your store in a modular, scalable way by composing smaller slices and combining them into a single store.
```ts
export type SliceCreator<TStore extends BaseType, TSlice = Partial<TStore>> = (
set: StateSetter<TStore>,
get: () => TStore | null,
) => TSlice;
```
**Usage**
```
const useKosha = create<StoreType>((...a) => ({
...createThemeSlice(...a),
...counterSlice(...a),
}));
```SliceCreator utility type.1 parent 821818f commit cb25fae
2 files changed
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| |||
0 commit comments