Skip to content

Commit

Permalink
Update index.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
threepointone committed Dec 30, 2024
1 parent bc80c60 commit 334ec7f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fixtures/todo-sync/src/client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function App() {
room: "default"
});

const [todos, mutate] = useSync<TodoRecord, TodoAction>(
const [todos, sendAction] = useSync<TodoRecord, TodoAction>(
"todos",
socket,
(todos, action): TodoRecord[] => {
Expand Down Expand Up @@ -58,7 +58,7 @@ function App() {
e.preventDefault();
if (newTodo.trim()) {
setNewTodo("");
mutate({
sendAction({
type: "create",
payload: {
id: crypto.randomUUID(),
Expand All @@ -72,7 +72,7 @@ function App() {
const toggleTodo = (id: string) => {
const todo = todos.find((todo) => todo[0] === id);
if (!todo) return;
mutate({
sendAction({
type: "update",
payload: {
id,
Expand All @@ -85,7 +85,7 @@ function App() {
const deleteTodo = (id: string) => {
const todo = todos.find((todo) => todo[0] === id);
if (!todo) return;
mutate({
sendAction({
type: "delete",
payload: { id }
});
Expand Down

0 comments on commit 334ec7f

Please sign in to comment.