react-native-global-state-hooks 3.0.8 → 4.0.1

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 +5 -5
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -73,7 +73,7 @@ export const useCount = createGlobalState(0, {
73
73
  setState((count) => count + value);
74
74
  };
75
75
  },
76
- },
76
+ } as const,
77
77
  });
78
78
  ```
79
79
 
@@ -118,7 +118,7 @@ export const useCount = createGlobalState(0, {
118
118
  actions.log(message);
119
119
  };
120
120
  },
121
- },
121
+ } as const,
122
122
  });
123
123
  ```
124
124
 
@@ -145,7 +145,7 @@ export const [useCount, getCount, $actions] =
145
145
  $actions.log(message);
146
146
  };
147
147
  },
148
- },
148
+ } as const,
149
149
  });
150
150
  ```
151
151
 
@@ -183,7 +183,7 @@ export const createGlobalState = createCustomGlobalState<
183
183
  isAsyncStorageReady: null,
184
184
  }));
185
185
 
186
- const asyncStorageKey = config.asyncStorageKey;
186
+ const asyncStorageKey = config?.asyncStorageKey;
187
187
  if (!asyncStorageKey) return;
188
188
 
189
189
  const storedItem = (await asyncStorage.getItem(asyncStorageKey)) as string;
@@ -206,7 +206,7 @@ export const createGlobalState = createCustomGlobalState<
206
206
  },
207
207
 
208
208
  onChange: ({ getState }, config) => {
209
- if (!config.asyncStorageKey) return;
209
+ if (!config?.asyncStorageKey) return;
210
210
 
211
211
  const state = getState();
212
212
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-global-state-hooks",
3
- "version": "3.0.8",
3
+ "version": "4.0.1",
4
4
  "description": "This is a package to easily handling global-state across your react-native-components No-redux",
5
5
  "main": "lib/bundle.js",
6
6
  "types": "lib/index.d.ts",