Skip to content

Commit a175f3f

Browse files
authored
Update README.md
1 parent 10cefab commit a175f3f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ const store = createStore({ players: 0 })
5959

6060
function subscribeToServerStore(listener) {
6161
// Incrementing number of player as a patch
62-
const listeners = store.applyPatch({ players: store.state.players + 1 })
62+
const listeners = store.applyPatch((state) => {
63+
state.players += 1
64+
})
6365
// We emit the patch to all the subscribers
6466
listeners.forEach(({ listener, patch }) => listener(patch))
6567
// Here we subscribe our client

0 commit comments

Comments
 (0)