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.
The `AgileHookConfigInterface` is used as configuration object in functions like [`useAgile()`](./packages/react/features/Hooks.md#useagile).
1135
+
Here is a Typescript Interface for quick reference. However,
1136
+
each property is explained in more detail below.
1137
+
```ts
1138
+
interfaceAgileHookConfigInterface {
1139
+
key?:SubscriptionContainerKeyType;
1140
+
agileInstance?:Agile;
1141
+
proxyBased?:boolean;
1142
+
}
1143
+
```
1144
+
1145
+
<br/>
1146
+
1147
+
#### `key`
1148
+
1149
+
The `key/name` of the [SubscriptionContainer](./packages/core/features/integration/Introduction.md#-subscriptions) that is created and added to the Observers.
1150
+
```ts
1151
+
useAgile(MY_STATE, {key: 'jeff'});
1152
+
```
1153
+
Such key can be very useful during debug sessions
1154
+
in order to analyse when which SubscriptionContainer triggered a rerender on the Component.
1155
+
```ts
1156
+
// Agile Debug: Registered Callback/Component based Subscription 'jeff', SubscriptionContainer('jeff')
The [Agile Instance](./packages/core/features/agile-instance/Introduction.md) the created [SubscriptionContainer](./packages/core/features/integration/Introduction.md#-subscriptions) belongs to.
1170
+
However, since each Observer has an instance to the Agile Instance, `useAgile()` can automatically derive the Agile Instance from that.
|[Agile Instance](./packages/core/features/agile-instance/Introduction.md)| undefined | No |
1175
+
1176
+
<br/>
1177
+
1178
+
#### `proxyBased`
1179
+
1180
+
If the `useAgile()` hook should wrap a [Proxy()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) around its return value/s.
1181
+
Through this Proxy, AgileTs is able to track accessed properties in the returned object/s
1182
+
and can construct a path to these.
1183
+
The paths allow AgileTs to rerender the Component more efficiently,
1184
+
by only causing a rerender when an actual accessed property value mutates.
1185
+
Normally, the Component is always rerendered on a State change,
1186
+
regardless of whether the property value is accessed in the Component.
1187
+
This is totally fine if the value is primitive, or the whole object is displayed.
1188
+
However, as soon as we display only a small part of the bound State value object,
The `ProxyHookConfigInterface` is used as configuration object in functions like [`useProxy()`](./packages/react/features/Hooks.md#useproxy).
1235
+
Here is a Typescript Interface for quick reference. However,
1236
+
each property is explained in more detail below.
1237
+
```ts
1238
+
interfaceProxyHookConfigInterface {
1239
+
key?:SubscriptionContainerKeyType;
1240
+
agileInstance?:Agile;
1241
+
}
1242
+
```
1243
+
1244
+
<br/>
1245
+
1246
+
#### `key`
1247
+
1248
+
The `key/name` of the [SubscriptionContainer](./packages/core/features/integration/Introduction.md#-subscriptions) that is created and added to the Observers.
1249
+
```ts
1250
+
useProxy(MY_STATE, {key: 'jeff'});
1251
+
```
1252
+
Such key can be very useful during debug sessions
1253
+
in order to analyse when which SubscriptionContainer triggered a rerender on the Component.
1254
+
```ts
1255
+
// Agile Debug: Registered Callback/Component based Subscription 'jeff', SubscriptionContainer('jeff')
The [Agile Instance](./packages/core/features/agile-instance/Introduction.md) the created [SubscriptionContainer](./packages/core/features/integration/Introduction.md#-subscriptions) belongs to.
1269
+
However, since each Observer has an instance to the Agile Instance, `useProxy()` can automatically derive the Agile Instance from that.
@@ -50,7 +50,7 @@ For Class Components, we provide the `AgileHOC`.
50
50
The `AgileHOC` is a Higher Order Component that is wrapped around a React Component.
51
51
It takes care of binding [Agile Sub Instances](../../main/Introduction.md#agile-sub-instance) (like States or Collections) to the wrapped React Component.
|`deps`| Array<SubscribableAgileInstancesType\>\| SubscribableAgileInstancesType | Agile Sub Instances that are bound to the Component in which the useAgile Hook is located | Yes |
306
+
|`config`|[ProxyHookConfigInterface](../../../Interfaces.md#proxyhookconfiginterface)| Configuration | No |
0 commit comments