From e7151b36ea87f2558b230824b4af76a8fd62edeb Mon Sep 17 00:00:00 2001 From: lourendotco <123704676+lourendotco@users.noreply.github.com> Date: Tue, 26 Nov 2024 20:38:14 +0100 Subject: [PATCH] fixed logic in setCount --- templates/react/app/components/Counter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/react/app/components/Counter.tsx b/templates/react/app/components/Counter.tsx index aab6bb5..6b10b31 100644 --- a/templates/react/app/components/Counter.tsx +++ b/templates/react/app/components/Counter.tsx @@ -35,7 +35,7 @@ export default function Counter() { const increment = () => { // optimistic local update - setCount((prev) => prev ?? 0 + 1); + setCount((prev) => (prev ?? 0) + 1); // send the update to the server socket.send("increment"); };