You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* position 0 - the value of the data in the store.<br>
69
-
* position 1 - a function *setValue* to modify the data in the store. When used, this function return a promise that resolve nothing, thus you can use `setValue('a value').then(() => {doSomething() //when the store did update})`<br>
70
-
* position 2 - a function *deleteValue* to delete the value from the store. When used, this function return a promise that resolve nothing, thus you can use `deleteValue('a value').then(() => {doSomething() //when the store did update})`
69
+
* position 1 - a function *setValue* to modify the data in the store.<br>
70
+
* position 2 - a function *deleteValue* to delete the value from the store.<br>
71
71
*
72
72
* @example
73
73
* import {useStore} from 'react-context-hook'
@@ -87,8 +87,8 @@ function useStore(key, defaultValue) {
87
87
/**
88
88
* Returns a function to set or update a variable in the store. You want to use this hook when you just need to modify the store, not read or delete a value from it.
89
89
* @param {string} key - the name of the variable to set in the store
90
-
* @returns {(value: any) => Promise<void>}
91
-
* @return {Function} - a function to set a variable in the store with the given name When used, this function return a promise that resolve nothing, thus you can use `setValue('a value').then(() => {doSomething() //when the store did update})`
90
+
* @returns {(value: any) => void}
91
+
* @return {Function} - a function to set a variable in the store with the given name<br>
92
92
*
93
93
* @example
94
94
* import {useSetStoreValue} from 'react-context-hook'
@@ -105,18 +105,18 @@ function useSetStoreValue(key) {
105
105
/**
106
106
* Returns a function to delete a variable in the store. You want to use this hook when you just need to delete a value in the store, not read or set a value from it.
107
107
* @param {string} key - the name of the variable to set in the store
108
-
* @returns {(value: any) => Promise<void>}
109
-
* @return {Function} - a function to delete a variable in the store with the given name. When used, this function return a promise that resolve nothing, thus you can use `deleteValue('a value').then(() => {doSomething() //when the store did update})`
108
+
* @returns {(value: any) => void}
109
+
* @return {Function} - a function to delete a variable in the store with the given name.
110
110
*
111
111
* @example
112
112
* import {useDeleteStoreValue} from 'react-context-hook'
@@ -125,10 +125,10 @@ function useDeleteStoreValue(key) {
125
125
* `const [value, setValue] = useGetAndSet('a_lookup_key_in_the_store')`. The name of the variable in the arry is arbitrary and you can choose any string you like.
126
126
* @param {string} key - The lookup key to find the saved value in the store
127
127
* @param {any} [defaultValue] - The default value if missing
128
-
* @returns {[any, (value: any) => Promise<void>]}
128
+
* @returns {[any, (value: any) => void]}
129
129
* @return {array} an array with length 2:<br>
130
130
* position 0 - the value of the data in the store.<br>
131
-
* position 1 - a function *setValue* to modify the data in the store. When used, this function return a promise that resolve nothing, thus you can use `setValue('a value').then(() => {doSomething() //when the store did update})`<br>
131
+
* position 1 - a function *setValue* to modify the data in the store.<br>
132
132
*
133
133
* @example
134
134
* import {useGetAndSet} from 'react-context-hook'
@@ -148,10 +148,10 @@ function useGetAndSet(key, defaultValue) {
148
148
* `const [value, deleteValue] = useGetAndDelete('a_lookup_key_in_the_store')`. The name of the variable in the arry is arbitrary and you can choose any string you like.
149
149
* @param {string} key - The lookup key to find the saved value in the store
150
150
*
151
-
* @returns {[any, (value: any) => Promise<void>]}
151
+
* @returns {[any, (value: any) => void]}
152
152
* @return {array} an array with length 2:<br>
153
153
* position 0 - the value of the data in the store.<br>
154
-
* position 1 - a function *deleteValue* to delete the data in the store. When used, this function return a promise that resolve nothing, thus you can use `deleteValue('a value').then(() => {doSomething() //when the store did update})`<br>
154
+
* position 1 - a function *deleteValue* to delete the data in the store.<br>
155
155
*
156
156
* @example
157
157
* import {useGetAndDelete} from 'react-context-hook'
@@ -169,10 +169,10 @@ function useGetAndDelete(key) {
169
169
* `const [setValue, deleteValue] = useGetAndDelete('a_lookup_key_in_the_store')`. The name of the variable in the arry is arbitrary and you can choose any string you like.
170
170
* @param {string} key - The lookup key to find the saved value in the store
* position 0 - a function *setValue* to modify the data in the store. When used, this function return a promise that resolve nothing, thus you can use `setValue('a value').then(() => {doSomething() //when the store did update})`<br>
175
-
* position 1 - a function *deleteValue* to delete the data in the store. When used, this function return a promise that resolve nothing, thus you can use `deleteValue('a value').then(() => {doSomething() //when the store did update})`<br>
174
+
* position 0 - a function *setValue* to modify the data in the store.<br>
175
+
* position 1 - a function *deleteValue* to delete the data in the store.<br>
176
176
*
177
177
* @example
178
178
* import {useGetAndDelete} from 'react-context-hook'
0 commit comments