Skip to content

Commit

Permalink
Minor fixes to todomvc-react example.
Browse files Browse the repository at this point in the history
  • Loading branch information
garethmj committed Dec 10, 2023
1 parent 202de6c commit 6501518
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
4 changes: 2 additions & 2 deletions examples/todomvc-react/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "todomvc-react",
"version": "0.0.0",
"version": "0.0.1",
"scripts": {
"dev": "vite",
"build": "tsc && vite build"
},
"dependencies": {
"@xstate/react": "beta",
"@xstate/react": "^4.0.0",
"classnames": "^2.3.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand Down
24 changes: 14 additions & 10 deletions examples/todomvc-react/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion examples/todomvc-react/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ This is an implementation of [TodoMVC](https://todomvc.com/) built with:
- TypeScript
- Vite

## [Open in CodeSandbox](https://codesandbox.io/p/sandbox/github/statelyai/xstate/tree/main/examples/todomvc-react)
## How to run

You may run the example locally with:

```shell
cd examples/todomvc-react
pnpm install
pnpm run dev
```

__OR__

[Open in CodeSandbox](https://codesandbox.io/p/sandbox/github/statelyai/xstate/tree/main/examples/todomvc-react)

__OR__

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/statelyai/xstate/tree/main/examples/todomvc-react)
2 changes: 1 addition & 1 deletion examples/todomvc-react/src/Todos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function Todos() {
todosActorRef.subscribe(() => {
localStorage.setItem(
'todos',
JSON.stringify(todosActorRef.getPersistedState?.())
JSON.stringify(todosActorRef.getPersistedSnapshot?.())
);
});
}, [todosActorRef]);
Expand Down

0 comments on commit 6501518

Please sign in to comment.