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/features/AgileHoc.md
+36-36Lines changed: 36 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,55 +5,54 @@ sidebar_label: AgileHOC
5
5
slug: /react/AgileHOC
6
6
---
7
7
8
-
`AgileHOC` is a [Higher-Order Component](https://reactjs.org/docs/higher-order-components.html), that helps us to bind States to our React Component.
9
-
10
8
:::info
11
9
12
-
It is mainly thought for [Class Components](https://reactjs.org/docs/components-and-props.html),
13
-
because for [Functional Components](https://reactjs.org/docs/components-and-props.html) we have create a much [neater solution](./Hooks.md), based on Hooks.
10
+
The `AgileHOC` is mainly thought for [Class Components](https://reactjs.org/docs/components-and-props.html),
11
+
as we recommend using Hooks in [Functional Components](https://reactjs.org/docs/components-and-props.html).
14
12
15
13
:::
16
14
17
-
The `AgileHOC` gets wrapped around our React Class Component, to
18
-
ensure that our Class Component rerender, whenever a bound State mutates.
19
-
The `output` of the passed States gets merged into the `props` of the Class Component.
20
-
The property where the State Value is represented in the `props` is named after the State Key.
15
+
The `AgileHOC` is a Higher Order Component that is wrapped around a React Component.
16
+
It takes care of binding [Agile Sub Instances](../../../main/Introduction.md#agile-sub-instance) (like States or Collections) to the wrapped React Component.
@@ -69,7 +68,6 @@ class RandomComponent extends React.Component {
69
68
<p>Props Value: {this.props.myFirstState}</p>
70
69
<button
71
70
onClick={() => {
72
-
// Lets's update the State Value
73
71
MY_STATE.set("Hello Friend!");
74
72
}}
75
73
>
@@ -88,17 +86,16 @@ render(<WrappedComponent/>);
88
86
### 🟦 Typescript
89
87
90
88
The `AgileHOC` is nearly 100% typesafe.
91
-
But the State Values that get merged into the `props`**aren't typesafe**.
92
-
Because of that reason we recommend using the direct State Value (`MY_STATE.value`).
89
+
But be aware that the [Agile Sub Instance](../../../main/Introduction.md#agile-sub-instance)`outputs` merged into the `props` property **aren't typesafe**.
0 commit comments