react-elmish 9.2.0-beta.1 → 9.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -423,7 +423,9 @@ function subscription (model: Model): SubscriptionResult<Message> {
|
|
|
423
423
|
}
|
|
424
424
|
```
|
|
425
425
|
|
|
426
|
-
This function gets the initialized model as parameter and returns a
|
|
426
|
+
This function gets the initialized model as parameter and returns a function that gets the `dispatch` function as parameter. This function is called when the component is mounted.
|
|
427
|
+
|
|
428
|
+
Because the return type of the `subscription` function is an array, you can define and return multiple functions.
|
|
427
429
|
|
|
428
430
|
In the function component we call `useElmish` and pass the subscription to it:
|
|
429
431
|
|
|
@@ -431,8 +433,6 @@ In the function component we call `useElmish` and pass the subscription to it:
|
|
|
431
433
|
const [{ date }] = useElmish({ name: "Subscriptions", props, init, update, subscription })
|
|
432
434
|
```
|
|
433
435
|
|
|
434
|
-
Because the return type is an array, you can define and return multiple subscription functions.
|
|
435
|
-
|
|
436
436
|
### Cleanup subscriptions
|
|
437
437
|
|
|
438
438
|
In the solution above `setInterval` will trigger events even if the component is removed from the DOM. To cleanup subscriptions, we can return a `destructor` function the same way as in the `useEffect` hook.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-elmish",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.1",
|
|
4
4
|
"description": "Elmish for React using Typescript",
|
|
5
5
|
"author": "atheck",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"semantic-release": "semantic-release"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"react": ">=16.8.0 <
|
|
18
|
+
"react": ">=16.8.0 <20"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@babel/cli": "7.26.4",
|