state-jet 2.0.22 → 2.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ For more details, see [here](https://statejet.netlify.app).
|
|
|
17
17
|
- [Binding Global State to a Component](#binding-global-state-to-a-component)
|
|
18
18
|
- [Slices](#slices)
|
|
19
19
|
- [Create Slice](#create-slice)
|
|
20
|
+
- [Multi States in Single Slice](#multi-states-in-single-slice)
|
|
20
21
|
- [Store](#store)
|
|
21
22
|
- [Create Store](#create-store)
|
|
22
23
|
- [Binding Store to a Component](#binding-store-to-a-component)
|
|
@@ -123,10 +124,8 @@ Slices in state-jet represent logical groupings of state that help organize appl
|
|
|
123
124
|
|
|
124
125
|
import { useSlice } from "state-jet";
|
|
125
126
|
|
|
126
|
-
const productSlice = useSlice("products");
|
|
127
127
|
const cartSlice = useSlice("cart");
|
|
128
128
|
|
|
129
|
-
export const useProductSlice = () => productSlice("productState", {});
|
|
130
129
|
export const useCartSlice = () => cartSlice("cartState", {});
|
|
131
130
|
```
|
|
132
131
|
|
|
@@ -137,12 +136,16 @@ export const useCartSlice = () => cartSlice("cartState", {});
|
|
|
137
136
|
|
|
138
137
|
import { useSlice } from "state-jet";
|
|
139
138
|
|
|
139
|
+
const productSlice = useSlice("products");
|
|
140
|
+
const cartSlice = useSlice("cart");
|
|
141
|
+
|
|
140
142
|
// Define multiple state values under one slice
|
|
141
143
|
export const useProductSlice = () => ({
|
|
142
144
|
productState: productSlice("productState", {}),
|
|
143
145
|
productFilter: productSlice("productFilter", { search: "", category: "all" }),
|
|
144
146
|
productSort: productSlice("productSort", { order: "asc" }),
|
|
145
147
|
});
|
|
148
|
+
export const useCartSlice = () => cartSlice("cartState", {});
|
|
146
149
|
```
|
|
147
150
|
|
|
148
151
|
## Store
|