@t8/react-store 1.0.28 → 1.0.29
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 +20 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,10 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
*Concise shared state management for React apps*
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
🔹 Similar to `useState()`
|
|
8
|
+
|
|
9
|
+
```diff
|
|
10
|
+
+ let store = new Store(0);
|
|
11
|
+
|
|
12
|
+
let Counter = () => {
|
|
13
|
+
- let [counter, setCounter] = useState(0);
|
|
14
|
+
+ let [counter, setCounter] = useStore(store);
|
|
15
|
+
|
|
16
|
+
let handleClick = () => {
|
|
17
|
+
setCounter(value => value + 1);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return <button onClick={handleClick}>+ {counter}</button>;
|
|
21
|
+
};
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
🔹 No boilerplate<br>
|
|
25
|
+
🔹 Painless transition from local state<br>
|
|
26
|
+
🔹 SSR- and CSR-compatible
|
|
11
27
|
|
|
12
28
|
Installation: `npm i @t8/react-store`
|
|
13
29
|
|