@cervello/react 1.0.4 → 1.0.6

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 +25 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Cervello
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@cervello/react?color=blue&style=flat-square)](https://www.npmjs.com/package/@cervello/react)
4
- [![dfs](https://img.shields.io/bundlephobia/minzip/@cervello/react/latest?color=orange&style=flat-square)](https://bundlephobia.com/package/@cervello/react@latest)
4
+ [![bundle-size](https://img.shields.io/bundlephobia/minzip/@cervello/react/latest?color=orange&style=flat-square)](https://bundlephobia.com/package/@cervello/react@latest)
5
5
 
6
6
 
7
7
  <a href="https://www.cervello.dev">
@@ -26,7 +26,7 @@
26
26
 
27
27
 
28
28
  ## 🚀 **Features**
29
- - ⚛️ Truly reactive on store change **_(nested properties too!!)_**
29
+ - ⚛️ Truly reactive on store change like normal objects without functions **_(nested properties too!!)_**
30
30
  - ✅ Super simple and minimalistic API
31
31
  - 🐨 Listen properties lazily
32
32
  - 👌 No unnecessary re-renders
@@ -60,6 +60,29 @@ export const {
60
60
  useSelector, // Hook to listen for changes on parts of the store
61
61
  reset, // Function to reset the store to initial value
62
62
  } = cervello({ count: 0 })
63
+
64
+
65
+ // With the store object you can use it outside of React components
66
+ const increment = () => store.count++
67
+
68
+
69
+ const Button = () => {
70
+ const { count } = useStore() // Listen for changes on the whole store
71
+ return (
72
+ <button onClick={increment}>
73
+ {count}
74
+ </button>
75
+ )
76
+ }
77
+
78
+ const ButtonWithSelector = () => {
79
+ const { count } = useSelector(['count']) // Listen for changes just on count property
80
+ return (
81
+ <button onClick={increment}>
82
+ {count}
83
+ </button>
84
+ )
85
+ }
63
86
  ```
64
87
  <br>
65
88
  <br>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cervello/react",
3
3
  "type": "module",
4
- "version": "1.0.4",
4
+ "version": "1.0.6",
5
5
  "description": "🤯 Simplest and truly reactive state manager for React",
6
6
  "author": "Chempo",
7
7
  "license": "MIT",