|
7 | 7 | [](https://github.com/react-gx/gx/blob/main/LICENSE) |
8 | 8 |
|
9 | 9 |
|
10 | | - |
| 10 | + |
| 11 | + |
11 | 12 |
|
12 | 13 | This library aims to provide you an `easy` and `fast` way to set up and manage the global state of your **`react`** application. |
13 | 14 |
|
@@ -123,7 +124,7 @@ For structuring your code very well you have to follow these steps. |
123 | 124 |
|
124 | 125 | Here is the result. |
125 | 126 |
|
126 | | - |
| 127 | + |
127 | 128 |
|
128 | 129 | ### Second step: Creating your signals. |
129 | 130 |
|
@@ -184,19 +185,19 @@ export default App; |
184 | 185 |
|
185 | 186 | ### Fifth step: Using your signals. |
186 | 187 |
|
187 | | -Create a component called `Counter` inside the Counter.js file. Then import two hooks from `gx` called `useSignal` and `useAction` like follow. |
| 188 | +Create a component called `Counter` inside the Counter.js file. Then import two hooks from `gx` called `useSignal` and `useActions` like follow. |
188 | 189 |
|
189 | 190 |
|
190 | 191 | ```js |
191 | 192 | import React from "react"; |
192 | | -import { useSignal, useAction } from "@dilane3/gx"; |
| 193 | +import { useSignal, useActions } from "@dilane3/gx"; |
193 | 194 |
|
194 | 195 | function Counter() { |
195 | 196 | // State |
196 | 197 | const counter = useSignal("counter"); |
197 | 198 |
|
198 | 199 | // Actions |
199 | | - const { increment, decrement } = useAction("counter"); |
| 200 | + const { increment, decrement } = useActions("counter"); |
200 | 201 |
|
201 | 202 | return ( |
202 | 203 | <div> |
@@ -278,30 +279,29 @@ This hook takes the name of the signal as a parameter and returns the state cont |
278 | 279 | const counter = useSignal("counter"); |
279 | 280 | ``` |
280 | 281 |
|
281 | | -### `useAction` |
| 282 | +### `useActions` |
282 | 283 |
|
283 | 284 | This hook takes the name of the signal as a the first parameter and returns an object that contains all the actions of this signal. |
284 | 285 |
|
285 | 286 | ```js |
286 | | -const { increment, decrement } = useAction("counter"); |
| 287 | +const { increment, decrement } = useActions("counter"); |
287 | 288 | ``` |
288 | 289 |
|
289 | | -**`New in version 1.1.0`** |
290 | | - |
291 | | -Note that, the `useAction` hook can accept a second parameter which is the list of actions that you want to use. If you don't specify the second parameter, all the actions of the signal will be returned. |
| 290 | +### `useAction` |
292 | 291 |
|
293 | | -There is another thing that you have to know. |
294 | | -If you provide only one action as a second parameter, the hook will return only the action itself and not an object that contains the action. |
| 292 | +This hook takes the name of the signal as the first parameter and the name of the action as the second one and then return that action. |
295 | 293 |
|
296 | 294 | ```js |
297 | 295 | const increment = useAction("counter", "increment"); |
298 | 296 | ``` |
299 | 297 |
|
300 | | -And if you provide more than one action, the hook will return an object that contains all the actions provided. |
| 298 | +See more on the [documentation](https://gx.dilane3.com/docs/guide/hooks/useAction) |
301 | 299 |
|
302 | | -```js |
303 | | -const { increment, decrement } = useAction("counter", "increment", "decrement"); |
304 | | -``` |
| 300 | +## TypeScript Support |
| 301 | + |
| 302 | +`GX` support TypeScript, so that you can use it directly into your application. |
| 303 | + |
| 304 | +See how to integrate it on the [documentation](https://gx.dilane3.com/docs/typescript) website |
305 | 305 |
|
306 | 306 | ## License |
307 | 307 |
|
|
0 commit comments