Skip to content

Commit b9c41e1

Browse files
davidkpianomellson
andauthored
Update blog/2023-09-19-persisting-state/index.mdx
Co-authored-by: Anders Bech Mellson <[email protected]>
1 parent 2a79508 commit b9c41e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

blog/2023-09-19-persisting-state/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ You may want to persist the state of this machine so that when the user comes ba
8484

8585
First, you should determine your [persistence strategy](#persistence-strategies). For this example, we'll use [the `localStorage` API](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage).
8686

87-
Actors created with `createActor` have a `.getPersistedState()` method that returns the state that should be persisted. This state is a plain object that can be serialized to JSON using `JSON.stringify(persistedState)`. Note that this "persisted state" may be slightly different from the `snapshot` state returned from `actor.getSnapshot()`. Since the persisted state is a plain object, you can persist it to any storage that you want, as long as it can be restored as an object.
87+
Actors created with `createActor` have a `.getPersistedState()` method that returns the state that should be persisted. This state is a plain object that can be serialized to JSON using `JSON.stringify(persistedState)`. Since the persisted state is a plain object, you can persist it to any storage that you want, as long as it can be restored as an object.
8888

8989
```ts
9090
// Read the state to persist from the actor (sync)

0 commit comments

Comments
 (0)