state-jet 2.0.10 → 2.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.
Files changed (2) hide show
  1. package/README.md +32 -16
  2. 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,11 @@ 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
- ## Basic Example Usage
44
+ ## GlobalState
45
+
46
+ The `useStateGlobal` hook is the simplest entry point to State-Jet. It allows you to create stateful values that can be accessed and updated from any component in your application, regardless of their location in the component tree.
47
+
48
+ ### Create GlobalState
43
49
 
44
50
  ```tsx
45
51
  import { useStateGlobal } from "state-jet";
@@ -51,23 +57,12 @@ function Counter() {
51
57
  return <button onClick={() => counter.set(count + 1)}>Count: {count}</button>;
52
58
  }
53
59
  ```
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
60
 
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
-
66
- ## Introduction to Slices
61
+ ## Slices
67
62
 
68
63
  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
64
 
70
- Each slice can contain multiple state values, each identified by a unique key within that slice. This hierarchical organization helps prevent naming collisions and improves code readability in larger applications.
65
+ Each slice can contain multiple state values, each identified by a unique key within that slice.
71
66
 
72
67
  ### Create Slice
73
68
 
@@ -81,9 +76,9 @@ export const useProductSlice = () => productSlice("list", []);
81
76
  export const useCartSlice = () => cartSlice("list", []);
82
77
  ```
83
78
 
84
- ## Introduction to Store
79
+ ## Store
85
80
 
86
- The useStore hook serves as a mechanism to group related slices of state into a cohesive store, enabling modular and organized state management in React applications. It creates a persistent reference to a collection of slice instances that can be accessed throughout an application component tree.
81
+ The `useStore` hook serves as a mechanism to group related slices of state into a cohesive store, enabling modular and organized state management in React applications. It creates a persistent reference to a collection of slice instances that can be accessed throughout an application component tree.
87
82
 
88
83
  ### Create Store
89
84
 
@@ -101,6 +96,8 @@ export const store = () => useStore(initializer);
101
96
 
102
97
  ## Middlewares
103
98
 
99
+ Middleware in state-jet is a powerful mechanism for intercepting, transforming, and processing state updates before they are applied to the store.
100
+
104
101
  Unlike other libraries, you do not need to rely on any external dependencies. A `middleware` property from `options` helps to add middleware for state-jet.
105
102
 
106
103
  ```bash
@@ -257,6 +254,25 @@ interface Todo = {
257
254
  const todoState = useStateGlobal<Todo[]>("todos", []);
258
255
  ```
259
256
 
257
+ ## Why state-jet Is More Advanced Than Zustand
258
+
259
+ - **No Proxies Needed**
260
+ → Zustand uses proxies for state updates, but state-jet uses signals, making it even faster.
261
+ - **Derived State Is Automatic**
262
+ → No need for selectors; state updates only trigger where necessary.
263
+ - **Optimistic Updates & Rollback**
264
+ → Unlike Zustand, state-jet has built-in support for instant UI updates and auto-revert on failures.
265
+ - **Multi-Tab Sync**
266
+ → global state persists across browser tabs and devices.
267
+ - **CRDT Support**
268
+ → Automatic conflict resolution for real-time apps, something even Zustand lacks.
269
+
270
+
271
+ ### ✅ Conclusion
272
+
273
+ 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. 🚀
274
+
275
+
260
276
  ## ⚡ Comparison Table
261
277
  | Feature | Redux | Recoil | MobX | Jotai | Zustand | state-jet |
262
278
  |--------------------------|--------|--------|-------|--------|------------------------|----------------------|
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "state-jet",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "description": "Ultra-lightweight global state management for React",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",