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
{{ message }}
This repository was archived by the owner on Feb 15, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/packages/react/Introduction.md
+9-10Lines changed: 9 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,17 +20,16 @@ slug: /react
20
20
21
21
## ❓ `react`
22
22
23
-
The `react` package integrates AgileTs into a [React](https://reactjs.org/) environment
24
-
and serves as an Interface for AgileTs to React.
23
+
The `react` package helps us to integrate AgileTs into a [React](https://reactjs.org/) environment
24
+
and serves as an Interface to React.
25
25
Its main task is to bind States to React Components.
26
26
This binding ensures that AgileTs rerender the Component whenever a bound State mutates.
27
-
It also offers some other valuable functionalities that optimize the workflow using AgileTs in a React environment.
27
+
It also offers some other valuable functionalities that optimize the workflow using AgileTs in a React project.
28
28
29
29
A distinction is made between `Functional` and `Class` Components.
30
-
As we prefer using [`React Hooks`](https://reactjs.org/docs/hooks-intro.html) in Functional Components,
30
+
As we prefer to use [`React Hooks`](https://reactjs.org/docs/hooks-intro.html) in Functional Components
31
31
but Hooks aren't supported in Class Components.
32
-
Therefore, we came across other solutions,
33
-
to offer the same functionalities in Class Components too.
32
+
Therefore, we have created alternatives for Class Components in order to offer the same functionalities there as well.
34
33
35
34
### 🐆 Functional Component
36
35
@@ -42,14 +41,14 @@ The `useAgile()` Hook binds [Agile Sub Instances](../../main/Introduction.md#agi
42
41
// Binds MY_FIRST_STATE to myComponent
43
42
const myFirstState =useAgile(MY_FIRST_STATE);
44
43
```
45
-
To find out more about `useAgile()`, and other Hooks provided by AgileTs.
46
-
Checkout the [AgileTs Hook documentation](./features/Hooks.md).
44
+
To find out more about `useAgile()`, and other Hooks provided by AgileTs,
45
+
checkout the [AgileTs Hook documentation](./features/Hooks.md).
47
46
48
47
### 🦖 Class Component
49
48
50
-
In Class Components, we only provide the `AgileHOC`.
49
+
For Class Components, we provide the `AgileHOC`.
51
50
The `AgileHOC` is a Higher Order Component that is wrapped around a React Component.
52
-
It ensures the binding of [Agile Sub Instances](../../main/Introduction.md#agile-sub-instance) (like States or Collections) to React Components.
51
+
It takes care of binding [Agile Sub Instances](../../main/Introduction.md#agile-sub-instance) (like States or Collections) to the wrapped React Component.
|`dep`| Array<SubscribableAgileInstancesType\>\| SubscribableAgileInstancesType | Agile Sub Instances that get bound to the Component the useAgile Hook is in | Yes |
170
-
|`key`| string \| number | Key/Name of Observer that gets created. Mainly thought for Debugging. | No |
171
-
|`agileInstance`| Agile | To which Agile Instance the State get bound. Gets autodetect if only one Agile Instance exists.| No |
172
+
|`deps`| Array<SubscribableAgileInstancesType\>\| SubscribableAgileInstancesType | Agile Sub Instances that are bound to the Component in which the useAgile Hook is located| Yes |
173
+
|`key`| string \| number | Key/Name of SubscriptionContainer that is created. Mainly thought for Debugging | No |
174
+
|`agileInstance`| Agile | To which Agile Instance the State belongs. Automatically recognised if only one Agile Instance exists. | No |
172
175
173
176
#### SubscribableAgileInstancesType
174
177
```ts
@@ -177,7 +180,7 @@ type SubscribableAgileInstancesType = State | Collection | Observer | undefined;
177
180
178
181
### 📄 Return
179
182
180
-
`useAgile` returns the current `output` of the passed [Agile Sub Instance/s](../../../main/Introduction.md#agile-sub-instance).
183
+
`useAgile()` returns the current `output` of the passed [Agile Sub Instance/s](../../../main/Introduction.md#agile-sub-instance).
0 commit comments