@xstate/react 4.1.0 → 4.1.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
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This package contains utilities for using [XState](https://github.com/statelyai/xstate) with [React](https://github.com/facebook/react/).
|
|
4
4
|
|
|
5
|
-
- [Read the full documentation in the XState docs](https://
|
|
5
|
+
- [Read the full documentation in the XState docs](https://stately.ai/docs/xstate-react).
|
|
6
6
|
- [Read our contribution guidelines](https://github.com/statelyai/xstate/blob/main/CONTRIBUTING.md).
|
|
7
7
|
|
|
8
8
|
## Quick start
|
|
@@ -15,7 +15,7 @@ npm i xstate @xstate/react
|
|
|
15
15
|
|
|
16
16
|
2. Import the `useMachine` hook:
|
|
17
17
|
|
|
18
|
-
```
|
|
18
|
+
```tsx
|
|
19
19
|
import { useMachine } from '@xstate/react';
|
|
20
20
|
import { createMachine } from 'xstate';
|
|
21
21
|
|
|
@@ -36,7 +36,7 @@ export const Toggler = () => {
|
|
|
36
36
|
const [state, send] = useMachine(toggleMachine);
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
|
-
<button onClick={() => send('TOGGLE')}>
|
|
39
|
+
<button onClick={() => send({ type: 'TOGGLE' })}>
|
|
40
40
|
{state.value === 'inactive'
|
|
41
41
|
? 'Click to activate'
|
|
42
42
|
: 'Active! Click to deactivate'}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function useSelector<TActor extends
|
|
1
|
+
import { AnyActorRef } from 'xstate';
|
|
2
|
+
export declare function useSelector<TActor extends Pick<AnyActorRef, 'subscribe' | 'getSnapshot'> | undefined, T>(actor: TActor, selector: (snapshot: TActor extends {
|
|
3
|
+
getSnapshot(): infer TSnapshot;
|
|
4
|
+
} ? TSnapshot : undefined) => T, compare?: (a: T, b: T) => boolean): T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xstate/react",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "XState tools for React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"state",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
58
|
-
"xstate": "^5.
|
|
58
|
+
"xstate": "^5.11.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependenciesMeta": {
|
|
61
61
|
"xstate": {
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"use-isomorphic-layout-effect": "^1.1.2",
|
|
67
|
-
"use-sync-external-store": "^1.
|
|
67
|
+
"use-sync-external-store": "^1.2.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@testing-library/react": "^
|
|
70
|
+
"@testing-library/react": "^14.2.1",
|
|
71
71
|
"@types/jsdom": "^12.2.3",
|
|
72
72
|
"@types/react": "^17.0.43",
|
|
73
73
|
"@types/react-dom": "^17.0.14",
|
|
@@ -76,6 +76,6 @@
|
|
|
76
76
|
"jsdom-global": "^3.0.2",
|
|
77
77
|
"react": "^18.0.0",
|
|
78
78
|
"react-dom": "^18.0.0",
|
|
79
|
-
"xstate": "5.
|
|
79
|
+
"xstate": "5.11.0"
|
|
80
80
|
}
|
|
81
81
|
}
|