Skip to content

Commit 18fd732

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

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ localStorage.setItem('some-state-key', JSON.stringify(persistedState));
9797
Retrieve the persisted state from storage and restore it as an object when creating the actor:
9898

9999
```ts
100+
// Read the persisted state from localStorage
101+
const restoredState = localStorage.getItem('some-state-key');
102+
100103
const actor = createActor(machine, {
101104
// Restore the state (if it exists)
102105
state: restoredState,

0 commit comments

Comments
 (0)