state-jet 1.0.9 β 1.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 +64 -7
- package/dist/index.cjs +1143 -34
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.mjs +1135 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +13 -22
- package/dist/crdt.js +0 -9
- package/dist/derived.js +0 -7
- package/dist/devtools.js +0 -40
- package/dist/encryption.js +0 -9
- package/dist/global.js +0 -12
- package/dist/hooks.js +0 -23
- package/dist/index.js +0 -5
- package/dist/middleware.js +0 -51
- package/dist/optimistic.js +0 -6
- package/dist/persistence.js +0 -14
- package/dist/store.js +0 -80
- package/dist/types/crdt.d.ts +0 -3
- package/dist/types/crdt.d.ts.map +0 -1
- package/dist/types/derived.d.ts +0 -2
- package/dist/types/derived.d.ts.map +0 -1
- package/dist/types/devtools.d.ts +0 -5
- package/dist/types/devtools.d.ts.map +0 -1
- package/dist/types/encryption.d.ts +0 -5
- package/dist/types/encryption.d.ts.map +0 -1
- package/dist/types/global.d.ts +0 -2
- package/dist/types/global.d.ts.map +0 -1
- package/dist/types/hooks.d.ts +0 -3
- package/dist/types/hooks.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -6
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/middleware.d.ts +0 -12
- package/dist/types/middleware.d.ts.map +0 -1
- package/dist/types/optimistic.d.ts +0 -2
- package/dist/types/optimistic.d.ts.map +0 -1
- package/dist/types/persistence.d.ts +0 -3
- package/dist/types/persistence.d.ts.map +0 -1
- package/dist/types/store.d.ts +0 -13
- package/dist/types/store.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -2,12 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
A zero-boilerplate, ultra-fast global state management library for React. No context, reducers, or providersβjust simple reactive state.
|
|
4
4
|
|
|
5
|
+
For more details, see [here](https://statejet.netlify.app).
|
|
6
|
+
|
|
5
7
|
## π Why state-jet?
|
|
6
8
|
- β
**No Context, No Providers** β Works outside React, reducing unnecessary re-renders.
|
|
7
9
|
- β
**Automatic Re-Renders** β Only components using specific state values update.
|
|
8
10
|
- β
**Super Lightweight** β Ultra small!
|
|
9
11
|
- β
**SSR & Next.js Support** β Works on both client and server.
|
|
10
12
|
|
|
13
|
+
## Documentation
|
|
14
|
+
|
|
15
|
+
Documentation: https://statejet.netlify.app/docs
|
|
16
|
+
|
|
17
|
+
Tutorials: https://statejet.netlify.app/docs/category/tutorial
|
|
18
|
+
|
|
19
|
+
API Reference: https://statejet.netlify.app/docs/category/api-reference
|
|
20
|
+
|
|
11
21
|
## π Installation
|
|
12
22
|
```bash
|
|
13
23
|
npm install state-jet
|
|
@@ -29,7 +39,7 @@ function Counter() {
|
|
|
29
39
|
|
|
30
40
|
| Feature | Redux | Recoil | MobX | Jotai | Zustand | state-jet |
|
|
31
41
|
| ------------------------ | ----------- | --------- | ------------- | --------- | ---------------------- | --------------------- |
|
|
32
|
-
| Setup
|
|
42
|
+
| Easy Setup | β No | β No | β οΈ No | β No | β οΈ Minimal | β
Ultra-Minimal |
|
|
33
43
|
| Bundle Size | π Large | π Medium | β‘ Small | β‘ Small | β‘ Small | π₯ Ultra-Small |
|
|
34
44
|
| Reactivity | β οΈ Reducers | β
Atoms | β
Proxy-Based | β
Signals | β
Proxy-Based | β
Signal-Like |
|
|
35
45
|
| Renders Only Affected | β No | β
Yes | β
Yes | β
Yes | β
Yes | β
Yes |
|
|
@@ -41,12 +51,59 @@ function Counter() {
|
|
|
41
51
|
|
|
42
52
|
## β‘ Why state-jet Is More Advanced Than Zustand
|
|
43
53
|
|
|
44
|
-
**No Proxies Needed** β Zustand uses proxies for state updates, but state-jet uses signals, making it even faster.
|
|
45
|
-
**Derived State Is Automatic** β No need for selectors; state updates only trigger where necessary.
|
|
46
|
-
**Optimistic Updates & Rollback** β Unlike Zustand, state-jet has built-in support for instant UI updates and auto-revert on failures.
|
|
47
|
-
**Multi-Tab Sync** β
|
|
48
|
-
**CRDT Support** β Automatic conflict resolution for real-time apps, something even Zustand lacks.
|
|
54
|
+
- **No Proxies Needed** β Zustand uses proxies for state updates, but state-jet uses signals, making it even faster.
|
|
55
|
+
- **Derived State Is Automatic** β No need for selectors; state updates only trigger where necessary.
|
|
56
|
+
- **Optimistic Updates & Rollback** β Unlike Zustand, state-jet has built-in support for instant UI updates and auto-revert on failures.
|
|
57
|
+
- **Multi-Tab Sync** β global state persists across browser tabs and devices.
|
|
58
|
+
- **CRDT Support** β Automatic conflict resolution for real-time apps, something even Zustand lacks.
|
|
49
59
|
|
|
50
60
|
β
Conclusion
|
|
51
61
|
|
|
52
|
-
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. π
|
|
62
|
+
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. π
|
|
63
|
+
|
|
64
|
+
## π― Why Use `optimisticUpdate`?
|
|
65
|
+
| Feature | Without `optimisticUpdate` | With `optimisticUpdate` |
|
|
66
|
+
| ----------------------- | -------------------------- | --------------------------- |
|
|
67
|
+
| **UI Responsiveness** | Delayed (Waits for API) | Instant update (Optimistic) |
|
|
68
|
+
| **User Experience** | Slow & Janky | Fast & Smooth |
|
|
69
|
+
| **Rollback on Failure** | Manual Handling | Automatic |
|
|
70
|
+
| **Code Complexity** | High | Low |
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## π― Why Use `syncCRDT`?
|
|
74
|
+
| Feature | Without `syncCRDT` | With `syncCRDT` |
|
|
75
|
+
| ---------------------- | ------------------ | ------------------------- |
|
|
76
|
+
| **Multi-User Sync** | Possible Conflicts | β
Automatic Merging |
|
|
77
|
+
| **Real-Time Updates** | Needs Manual Fixes | β
No Data Loss |
|
|
78
|
+
| **Handles Conflicts** | Can Lose Changes | β
Merges Automatically |
|
|
79
|
+
| **Scalable for Teams** | Hard to Maintain | β
Ideal for Collaboration |
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## π― Why Use `derivedState`?
|
|
83
|
+
|
|
84
|
+
| Feature | Without `derivedState` | With `derivedState` |
|
|
85
|
+
| ------------------------- | -------------------------- | ----------------------------- |
|
|
86
|
+
| **Manual Recalculations** | β Yes (Recompute manually) | β
Automatic |
|
|
87
|
+
| **Reactivity** | β Requires `useEffect` | β
Updates only when needed |
|
|
88
|
+
| **Performance** | β Unoptimized | β
Only recalculates on change |
|
|
89
|
+
| **Code Complexity** | β High | β
Minimal |
|
|
90
|
+
|
|
91
|
+
## π― Why Use undo & redo?
|
|
92
|
+
|
|
93
|
+
| Feature | Without Undo/Redo | With Undo/Redo |
|
|
94
|
+
| ---------------------- | ----------------------- | ------------------------- |
|
|
95
|
+
| **Accidental Changes** | β Lost forever | β
Easily undone |
|
|
96
|
+
| **User Experience** | β Frustrating | β
Smooth & intuitive |
|
|
97
|
+
| **Multi-Step Editing** | β Hard to track | β
Easy to restore history |
|
|
98
|
+
| **Performance** | β Needs manual tracking | β
Automatic |
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
## Contributing
|
|
102
|
+
|
|
103
|
+
Development of State-jet happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving State-jet.
|
|
104
|
+
|
|
105
|
+
- [Contributing Guide](./CONTRIBUTING.md)
|
|
106
|
+
|
|
107
|
+
### License
|
|
108
|
+
|
|
109
|
+
State-jet is [MIT licensed](./LICENSE).
|