state-jet 1.0.10 β 1.0.12
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/LICENSE +21 -0
- package/README.md +64 -7
- package/dist/index.cjs +3 -1083
- package/dist/index.d.ts +14 -8
- package/dist/index.mjs +3 -1073
- package/package.json +3 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Venkatesh Sundaram
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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).
|