react-native-global-state-hooks 16.0.4 → 16.0.5

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 CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  <div align="center">
10
10
 
11
- **Zero setup. Native persistence. Maximum performance.** 🚀
11
+ **Shared React Native state. Precise subscriptions. Async persistence.** 🚀
12
12
 
13
13
  _The simplicity of `useState`, shared across your React Native app._ ✨
14
14
 
@@ -16,7 +16,7 @@ _The simplicity of `useState`, shared across your React Native app._ ✨
16
16
  [![Downloads](https://img.shields.io/npm/dm/react-native-global-state-hooks.svg)](https://www.npmjs.com/package/react-native-global-state-hooks)
17
17
  [![License](https://img.shields.io/npm/l/react-native-global-state-hooks.svg)](https://github.com/johnny-quesada-developer/react-native-global-state-hooks/blob/master/LICENSE)
18
18
 
19
- [**NPM**](https://www.npmjs.com/package/react-native-global-state-hooks) • [**GitHub**](https://github.com/johnny-quesada-developer/react-native-global-state-hooks) • [**Core API Demo**](https://johnny-quesada-developer.github.io/global-hooks-example/) • [**Video Tutorial**](https://www.youtube.com/watch?v=1UBqXk2MH8I/)
19
+ [**NPM**](https://www.npmjs.com/package/react-native-global-state-hooks) • [**GitHub**](https://github.com/johnny-quesada-developer/react-native-global-state-hooks) • [**Core API Demo**](https://johnny-quesada-developer.github.io/global-hooks-example/) • [**Video Tutorial**](https://www.youtube.com/watch?v=1UBqXk2MH8I)
20
20
 
21
21
  </div>
22
22
 
@@ -44,9 +44,9 @@ function Counter() {
44
44
 
45
45
  ---
46
46
 
47
- ## 🚀 Why Developers Love This Library
47
+ ## 🚀 Built for React applications
48
48
 
49
- ### 🎓 **Zero Learning Curve**
49
+ ### 🎓 **Familiar React API**
50
50
 
51
51
  If you know `useState`, the basic API already feels familiar:
52
52
 
@@ -203,7 +203,7 @@ function ThemeToggle() {
203
203
  }
204
204
  ```
205
205
 
206
- ### 60 Seconds to Production-Ready
206
+ ### Actions with async persistence
207
207
 
208
208
  A persisted React Native store initializes **asynchronously**, so the hook also exposes storage readiness through metadata.
209
209
 
@@ -424,9 +424,9 @@ const useActiveAdmins = useActiveUsers.createSelectorHook((users) =>
424
424
  );
425
425
 
426
426
  function UserStats() {
427
- const [users] = useUsers();
428
- const [activeUsers] = useActiveUsers();
429
- const [activeAdmins] = useActiveAdmins();
427
+ const users = useUsers();
428
+ const activeUsers = useActiveUsers();
429
+ const activeAdmins = useActiveAdmins();
430
430
 
431
431
  return (
432
432
  <View>
@@ -594,7 +594,7 @@ useFeed.setMetadata((metadata) => ({
594
594
  isLoading: true,
595
595
  }));
596
596
 
597
- const metadata = useFeed.getMetadata();
597
+ const metadata = useFeed.metadata;
598
598
 
599
599
  console.log(metadata.isLoading);
600
600
  ```
@@ -1023,7 +1023,7 @@ const useUsers = Data.use.createSelectorHook((state) => state.users);
1023
1023
  const useActiveUsers = useUsers.createSelectorHook((users) => users.filter((user) => user.active));
1024
1024
 
1025
1025
  function ActiveUsers() {
1026
- const [users] = useActiveUsers();
1026
+ const users = useActiveUsers();
1027
1027
 
1028
1028
  return (
1029
1029
  <View>
@@ -1323,7 +1323,7 @@ const useApp = createGlobalState({
1323
1323
  | 📦 [**NPM Package**](https://www.npmjs.com/package/react-native-global-state-hooks) | Published React Native package |
1324
1324
  | 💻 [**GitHub Repository**](https://github.com/johnny-quesada-developer/react-native-global-state-hooks) | Source, tests, and issues |
1325
1325
  | 🎮 [**Core API Demo**](https://johnny-quesada-developer.github.io/global-hooks-example/) | Browser demo of the shared state-management concepts |
1326
- | 🎥 [**Video Tutorial**](https://www.youtube.com/watch?v=1UBqXk2MH8I/) | State-management walkthrough |
1326
+ | 🎥 [**Video Tutorial**](https://www.youtube.com/watch?v=1UBqXk2MH8I) | State-management walkthrough |
1327
1327
  | 📚 [**Core Package**](https://www.npmjs.com/package/react-hooks-global-states) | Shared state engine used by the platform packages |
1328
1328
 
1329
1329
  ---
@@ -1342,7 +1342,7 @@ The state-management concepts are intentionally similar across the packages, but
1342
1342
 
1343
1343
  ## 🎉 Why Developers Choose This
1344
1344
 
1345
- ### The Bottom Line
1345
+ ### At a glance
1346
1346
 
1347
1347
  | What You Get | What You Avoid |
1348
1348
  | ----------------------------------- | ---------------------------------- |
@@ -30,7 +30,7 @@ interface CreateGlobalState {
30
30
  * @param args.name optional name for debugging purposes
31
31
  * @param args.metadata optional non-reactive metadata associated with the state
32
32
  * @param args.callbacks optional lifecycle callbacks for the global state
33
- * @param args.actions optional actions to restrict state mutations [if provided `setState` will be nullified]
33
+ * @param args.actions Optional actions returned as the hook’s second item; `setState` remains available on the store API
34
34
  * @param args.asyncStorage optional configuration to persist the state in local storage
35
35
  * @returns a state hook that you can use in your components
36
36
  *
@@ -87,7 +87,7 @@ interface CreateGlobalState {
87
87
  * @param args.name optional name for debugging purposes
88
88
  * @param args.metadata optional non-reactive metadata associated with the state
89
89
  * @param args.callbacks optional lifecycle callbacks for the global state
90
- * @param args.actions optional actions to restrict state mutations [if provided `setState` will be nullified]
90
+ * @param args.actions Optional actions returned as the hook’s second item; `setState` remains available on the store API
91
91
  * @param args.asyncStorage optional configuration to persist the state in local storage
92
92
  * @returns a state hook that you can use in your components
93
93
  *
package/debug.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(p,o,i,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of x(o))!a.call(p,r)&&r!==i&&e(p,r,{get:()=>o[r],enumerable:!(t=m(o,r))||t.enumerable});return p};var c=p=>b(e({},"__esModule",{value:!0}),p);var d={};module.exports=c(d);var g=require("react-hooks-global-states/debug");
package/debug.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import 'react-hooks-global-states/debug';
2
+ export {};
package/debug.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(p,o,i,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of x(o))!a.call(p,r)&&r!==i&&e(p,r,{get:()=>o[r],enumerable:!(t=m(o,r))||t.enumerable});return p};var c=p=>b(e({},"__esModule",{value:!0}),p);var d={};module.exports=c(d);var g=require("react-hooks-global-states/debug");
package/debug.mjs ADDED
@@ -0,0 +1 @@
1
+ import"react-hooks-global-states/debug";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-global-state-hooks",
3
- "version": "16.0.4",
4
- "description": "This is a package to easily handling global-state across your react-native-components No-redux... The library now includes @react-native-async-storage/async-storage to persist your state across sessions... if you want to keep using the old version without async-storage or react-native dependencies just use version 5.0.15 or user react-hooks-global-states instead",
3
+ "version": "16.0.5",
4
+ "description": "Shared React Native state with a useState-style API, selective subscriptions, actions and async persistence with optional AsyncStorage.",
5
5
  "main": "./bundle.cjs",
6
6
  "module": "./bundle.mjs",
7
7
  "types": "./index.d.ts",
@@ -62,6 +62,11 @@
62
62
  "import": "./actions.mjs",
63
63
  "require": "./actions.cjs"
64
64
  },
65
+ "./debug": {
66
+ "types": "./debug.d.ts",
67
+ "import": "./debug.mjs",
68
+ "require": "./debug.cjs"
69
+ },
65
70
  "./package.json": "./package.json"
66
71
  },
67
72
  "files": [
@@ -113,6 +118,9 @@
113
118
  }
114
119
  },
115
120
  "dependencies": {
116
- "react-hooks-global-states": "^16.0.4"
121
+ "react-hooks-global-states": "^16.0.5"
122
+ },
123
+ "bin": {
124
+ "rgsh": "./rgsh.mjs"
117
125
  }
118
126
  }
package/rgsh.mjs ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import 'react-hooks-global-states/rgsh';