From 49bdfb4f8c1e0f999e208ddde008e74defc2917c Mon Sep 17 00:00:00 2001 From: Christian van der Loo Date: Thu, 22 Aug 2024 22:44:37 -0400 Subject: [PATCH] docs: update README.md --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 246eb20..e4900ed 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ The middleware layer takes in your store creation function and a compute functio ```js import { createComputed } from "zustand-computed" -const computeState = (state) => ({ +const computeState = createComputed(state) => ({ countSq: state.count ** 2, -}) +})) const useStore = create( computed( @@ -38,8 +38,7 @@ const useStore = create( // get() function has access to ComputedStore square: () => set(() => ({ count: get().countSq })), root: () => set((state) => ({ count: Math.floor(Math.sqrt(state.count)) })), - }), - computeState + }) ) ) ```