Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit 976a266

Browse files
committed
fixed typos
1 parent 4c7ded6 commit 976a266

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

docs/packages/react/Introduction.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,16 @@ slug: /react
2020

2121
## `react`
2222

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.
2525
Its main task is to bind States to React Components.
2626
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.
2828

2929
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
3131
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.
3433

3534
### 🐆 Functional Component
3635

@@ -42,14 +41,14 @@ The `useAgile()` Hook binds [Agile Sub Instances](../../main/Introduction.md#agi
4241
// Binds MY_FIRST_STATE to myComponent
4342
const myFirstState = useAgile(MY_FIRST_STATE);
4443
```
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).
4746

4847
### 🦖 Class Component
4948

50-
In Class Components, we only provide the `AgileHOC`.
49+
For Class Components, we provide the `AgileHOC`.
5150
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.
5352
```ts
5453
// -- myComponent.jsx ------------------------------------------
5554

docs/packages/react/features/Hooks.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Be aware that [React Hooks](https://reactjs.org/docs/hooks-intro.html) are only
1212
:::
1313

1414

15-
## `useAgile`
15+
## `useAgile()`
1616

1717
The `useAgile()` React Hook, helps us to bind States to Functional React Components.
18-
This binding ensures that the Component rerender, whenever the bound State mutates.
18+
This binding ensures that the Component rerender, whenever a bound State mutates.
1919
We can flexibly bind any State to any React Component.
2020
```ts
2121
const myCoolState = useAgile(MY_COOL_STATE);
@@ -29,7 +29,7 @@ const MY_STATE = App.createState('jeff');
2929
const myState = useAgile(MY_STATE);
3030
console.log(myState); // Returns 'jeff'
3131
```
32-
It is also possible to bind more than one State at once to a React Component.
32+
It is also possible to bind more than one State to a React Component at once.
3333
```ts
3434
const [myCoolState1, myCoolState2] = useAgile([MY_COOL_STATE1, MY_COOL_STATE2]);
3535
```
@@ -45,10 +45,13 @@ console.log(myState); // Returns 'jeff'
4545
console.log(myState2); // Returns 'frank'
4646
```
4747
The binding of multiple State Instances at once has one advantage.
48-
It can lower the rerender count of the React Component,
49-
because AgileTs combines multiple at the same point in time triggered rerender of different States,
50-
if they have the same `SubscriptionContainer`. Each used `useAgile()` creates its own `SubscriptionContainer`.
48+
It can lower the rerender count of the React Component.
49+
AgileTs can combine simultaneously triggered rerender of different States,
50+
if they share the same `SubscriptionContainer`.
51+
Each `useAgile()` Hook creates its own `SubscriptionContainer`,
52+
which serves as an interface to trigger render on the Component.
5153

54+
### Subscribable Instances
5255
We are not limited to States, we can bind any [Agile Sub Instance](../../../main/Introduction.md#agile-sub-instance) that owns
5356
an `observer` to a React Component.
5457
```ts
@@ -159,16 +162,16 @@ Instances that can be bound to a React Component via the `useAgile()` Hook:
159162

160163
### 🟦 Typescript
161164

162-
`useAgile` is almost 100% typesafe.
163-
There are a few side cases you probably won't run into.
165+
The `useAgile()` Hook is almost 100% typesafe.
166+
However, there are a few side cases you probably won't run into.
164167

165168
### 📭 Props
166169

167170
| Prop | Type | Description | Required |
168171
| ----------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------|
169-
| `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 |
172175

173176
#### SubscribableAgileInstancesType
174177
```ts
@@ -177,7 +180,7 @@ type SubscribableAgileInstancesType = State | Collection | Observer | undefined;
177180

178181
### 📄 Return
179182

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).
181184

182185
```ts {6,9}
183186
const MY_STATE = App.State(1);
@@ -201,7 +204,7 @@ useAgile([MY_STATE, MY_STATE_2, MY_STATE_3]); // Returns [1, 2, 3]
201204

202205

203206

204-
## `useWatcher`
207+
## `useWatcher()`
205208

206209
With the `useWatcher` React Hook we are able to create a callback function that gets called whenever
207210
the passed State mutates. It's a synonym to the `watch` function, but might be cleaner to read in a React Component.
@@ -251,5 +254,7 @@ render(<RandomComponent/>);
251254

252255
### 📄 Return
253256

254-
`useWatcher` returns nothing.
257+
```ts
258+
void
259+
```
255260

0 commit comments

Comments
 (0)