state-jet 2.0.10 → 2.0.11
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 +18 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,8 @@ Tutorials: https://statejet.netlify.app/docs/category/tutorial
|
|
|
17
17
|
|
|
18
18
|
API Reference: https://statejet.netlify.app/docs/category/api-reference
|
|
19
19
|
|
|
20
|
+
Wiki: https://deepwiki.com/venkateshsundaram/state-jet
|
|
21
|
+
|
|
20
22
|
## 🛠 Installation
|
|
21
23
|
|
|
22
24
|
The Statejet package lives in npm. Please see the [installation guide](https://statejet.netlify.app/docs/getting-started/installation-and-setup/).
|
|
@@ -39,7 +41,9 @@ Or if you're using `cdn`:
|
|
|
39
41
|
<script src="https://cdn.jsdelivr.net/npm/state-jet@latest/dist/index.cjs"></script>
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
##
|
|
44
|
+
## Introduction to GlobalState
|
|
45
|
+
|
|
46
|
+
### Create GlobalState
|
|
43
47
|
|
|
44
48
|
```tsx
|
|
45
49
|
import { useStateGlobal } from "state-jet";
|
|
@@ -51,23 +55,12 @@ function Counter() {
|
|
|
51
55
|
return <button onClick={() => counter.set(count + 1)}>Count: {count}</button>;
|
|
52
56
|
}
|
|
53
57
|
```
|
|
54
|
-
## Why state-jet Is More Advanced Than Zustand
|
|
55
|
-
|
|
56
|
-
- **No Proxies Needed** → Zustand uses proxies for state updates, but state-jet uses signals, making it even faster.
|
|
57
|
-
- **Derived State Is Automatic** → No need for selectors; state updates only trigger where necessary.
|
|
58
|
-
- **Optimistic Updates & Rollback** → Unlike Zustand, state-jet has built-in support for instant UI updates and auto-revert on failures.
|
|
59
|
-
- **Multi-Tab Sync** → global state persists across browser tabs and devices.
|
|
60
|
-
- **CRDT Support** → Automatic conflict resolution for real-time apps, something even Zustand lacks.
|
|
61
|
-
|
|
62
|
-
### ✅ Conclusion
|
|
63
|
-
|
|
64
|
-
If you need the simplest, fastest, and most advanced state management solution for React, state-jet beats Redux, Recoil, MobX, Jotai, and even Zustand in performance, reactivity, and developer experience. 🚀
|
|
65
58
|
|
|
66
59
|
## Introduction to Slices
|
|
67
60
|
|
|
68
61
|
Slices in state-jet represent logical groupings of state that help organize application data into manageable pieces. Unlike the global state approach which uses a single namespace, slices allow for partitioning state into named segments, making state management more modular and maintainable.
|
|
69
62
|
|
|
70
|
-
Each slice can contain multiple state values, each identified by a unique key within that slice.
|
|
63
|
+
Each slice can contain multiple state values, each identified by a unique key within that slice.
|
|
71
64
|
|
|
72
65
|
### Create Slice
|
|
73
66
|
|
|
@@ -257,6 +250,18 @@ interface Todo = {
|
|
|
257
250
|
const todoState = useStateGlobal<Todo[]>("todos", []);
|
|
258
251
|
```
|
|
259
252
|
|
|
253
|
+
## Why state-jet Is More Advanced Than Zustand
|
|
254
|
+
|
|
255
|
+
- **No Proxies Needed** → Zustand uses proxies for state updates, but state-jet uses signals, making it even faster.
|
|
256
|
+
- **Derived State Is Automatic** → No need for selectors; state updates only trigger where necessary.
|
|
257
|
+
- **Optimistic Updates & Rollback** → Unlike Zustand, state-jet has built-in support for instant UI updates and auto-revert on failures.
|
|
258
|
+
- **Multi-Tab Sync** → global state persists across browser tabs and devices.
|
|
259
|
+
- **CRDT Support** → Automatic conflict resolution for real-time apps, something even Zustand lacks.
|
|
260
|
+
|
|
261
|
+
### ✅ Conclusion
|
|
262
|
+
|
|
263
|
+
If you need the simplest, fastest, and most advanced state management solution for React, state-jet beats Redux, Recoil, MobX, Jotai, and even Zustand in performance, reactivity, and developer experience. 🚀
|
|
264
|
+
|
|
260
265
|
## ⚡ Comparison Table
|
|
261
266
|
| Feature | Redux | Recoil | MobX | Jotai | Zustand | state-jet |
|
|
262
267
|
|--------------------------|--------|--------|-------|--------|------------------------|----------------------|
|