Skip to content

Commit 8094841

Browse files
committed
Embed state machine
1 parent 05a69d3 commit 8094841

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

blog/2023-10-02-persisting-state/index.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ const checkoutActor = createActor(machine, {
9191
});
9292
```
9393

94+
<EmbedMachine
95+
embedURL="https://stately.ai/registry/editor/embed/092bf401-2d65-48ae-969c-99b4a7eeb87f?machineId=6777d80d-82d8-41dc-9cd3-c6951495ff0f"
96+
name="checkout"
97+
/>
98+
9499
You may want to persist the state of this machine so that when the user comes back to the site, the items in their cart are still there, and the step in the checkout process is still the same. To do this, we need to remember to do two things:
95100

96101
- **Persist the state** to some storage (e.g., localStorage, a database, etc.)
@@ -147,4 +152,4 @@ There are [examples of persisting state that can be found in the XState git repo
147152
- [Persisting state to a writable `.json` file](https://github.com/statelyai/xstate/blob/next/examples/persisted-donut-maker)
148153
- [Persisting state to MongoDB](https://github.com/statelyai/xstate/tree/next/examples/mongodb-persisted-state)
149154

150-
Feel free to [suggest other examples at on our examples request board](https://feedback.stately.ai/examples), or [contribute your own](https://github.com/statelyai/xstate/tree/next/examples)!
155+
Feel free to [suggest other examples at on our examples request board](https://feedback.stately.ai/examples), or [contribute your own examples](https://github.com/statelyai/xstate/tree/next/examples)!

0 commit comments

Comments
 (0)