Skip to content

Commit 403861c

Browse files
authored
Merge pull request #181 from statelyai/laurakalbag/sta-4750-add-links-to-more-detailed-docs-below-examples-on-xstate-v5
Add links to more detailed docs below examples on xstate v5 cheatsheet
2 parents 09a702e + 4e54609 commit 403861c

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

versioned_docs/version-5/cheatsheet.mdx

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 'Cheatsheet'
33
---
44

5-
This is a cheatsheet that you can use to quickly look up the syntax for XState v5 beta.
5+
Use this cheatsheet to quickly look up the syntax for XState v5 beta.
66

77
## Installing XState
88

@@ -14,6 +14,8 @@ yarn add xstate
1414
npm install xstate
1515
```
1616

17+
[Read more on installing XState](installation.mdx).
18+
1719
## Creating a state machine
1820

1921
```ts
@@ -56,6 +58,8 @@ actor.send({ type: 'toggle' });
5658
// logs 'inactive' with context { count: 2 }
5759
```
5860

61+
[Read more about the actor model](actor-model.mdx).
62+
5963
## Creating promise logic
6064

6165
```ts
@@ -74,12 +78,14 @@ actor.subscribe((snapshot) => {
7478
});
7579

7680
actor.start();
77-
// logs something like: {
78-
// message: 'https://images.dog.ceo/breeds/terrier-norwich/n02094258_1003.jpg',
79-
// status: 'success'
81+
// logs: {
82+
// message: "https://images.dog.ceo/breeds/kuvasz/n02104029_110.jpg",
83+
// status: "success"
8084
// }
8185
```
8286

87+
[Read more about promise actor logic](actors.mdx#promise-actor-logic).
88+
8389
## Creating transition logic
8490

8591
A transition function is just like a reducer.
@@ -114,6 +120,8 @@ actor.send({ type: 'inc' });
114120
// logs { count: 2 }
115121
```
116122

123+
[Read more about transition actors](actors.mdx#transition-actors).
124+
117125
## Creating observable logic
118126

119127
```ts
@@ -133,6 +141,8 @@ actor.start();
133141
// every second
134142
```
135143

144+
[Read more about observable actors](actors.mdx#observable-actors).
145+
136146
## Creating callback logic
137147

138148
```ts
@@ -163,6 +173,8 @@ actor.send({ type: 'cancel' });
163173
// logs 'canceled'
164174
```
165175

176+
[Read more about callback actors](actors.mdx#callback-actors).
177+
166178
## Parent states
167179

168180
```ts
@@ -193,6 +205,8 @@ actor.start();
193205
// logs { active: 'one' }
194206
```
195207

208+
[Read more about parent states](parent-states.mdx).
209+
196210
## Actions
197211

198212
```ts
@@ -263,6 +277,8 @@ actor.send({ type: 'toggle' });
263277
// logs 'Activating'
264278
```
265279

280+
[Read more about actions](actions.mdx).
281+
266282
## Guards
267283

268284
```ts
@@ -314,6 +330,8 @@ actor.start();
314330
// logs 'Cannot be toggled'
315331
```
316332

333+
[Read more about guards](guards.mdx).
334+
317335
## Invoking actors
318336

319337
```ts
@@ -367,6 +385,8 @@ actor.start();
367385
// { id: 1, name: 'Leanne Graham', ... }
368386
```
369387

388+
[Read more about invoking actors](invoke.mdx).
389+
370390
## Spawning actors
371391

372392
```ts
@@ -405,6 +425,8 @@ actor.send({ type: 'loadUser' });
405425
// { id: 1, name: 'Leanne Graham', ... }
406426
```
407427

428+
[Read more about spawning actors](spawn.mdx).
429+
408430
## Input and output
409431

410432
```ts
@@ -433,6 +455,8 @@ actor.start();
433455
// logs 'Hello, David'
434456
```
435457

458+
[Read more about input](input.mdx).
459+
436460
## Invoking actors with input
437461

438462
```ts
@@ -474,3 +498,5 @@ actor.start();
474498
// eventually logs:
475499
// { id: 3, name: 'Clementine Bauch', ... }
476500
```
501+
502+
[Read more about invoking actors with input](input.mdx#invoking-actors-with-input).

0 commit comments

Comments
 (0)