From c0cd364b8fbbef940bfcccf0b2bf2bd1fa039876 Mon Sep 17 00:00:00 2001 From: Tibinko Date: Wed, 28 Aug 2024 02:44:04 +0200 Subject: [PATCH 1/4] docs: typo in typescript docs (#2708) --- docs/guides/typescript.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/guides/typescript.md b/docs/guides/typescript.md index 001aff64ae..647c533d62 100644 --- a/docs/guides/typescript.md +++ b/docs/guides/typescript.md @@ -499,9 +499,8 @@ const bearStore = createStore()((set) => ({ increase: (by) => set((state) => ({ bears: state.bears + by })), })) -const createBoundedUseStore = ((store) => (selector) => useStore(store)) as < - S extends StoreApi, ->( +const createBoundedUseStore = ((store) => (selector) => + useStore(store, selector)) as >( store: S, ) => { (): ExtractState From 7c369422612fbe0e5daab07951148341db4f5d04 Mon Sep 17 00:00:00 2001 From: Antoine BERNIER Date: Wed, 28 Aug 2024 13:29:14 +0200 Subject: [PATCH 2/4] relative images as much as possible (#2710) --- docs/getting-started/introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started/introduction.md b/docs/getting-started/introduction.md index a05280e2f5..59b29fec57 100644 --- a/docs/getting-started/introduction.md +++ b/docs/getting-started/introduction.md @@ -5,7 +5,7 @@ nav: 0 ---
- +
A small, fast, and scalable bearbones state management solution. From 9e8b7a5eea9c0a9f04dccf9e02fbfe9e1f4fd9e9 Mon Sep 17 00:00:00 2001 From: Antoine BERNIER Date: Thu, 29 Aug 2024 09:28:36 +0200 Subject: [PATCH 3/4] chore: using pmndrs/docs v2 --- .github/workflows/docs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index da854057d8..56e462ee52 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -11,9 +11,9 @@ concurrency: jobs: build: - uses: pmndrs/docs/.github/workflows/build.yml@v1 + uses: pmndrs/docs/.github/workflows/build.yml@v2 with: - mdx: './docs' + mdx: 'docs' libname: 'Zustand' home_redirect: '/getting-started/introduction' icon: '/favicon.ico' From 4ec7077de5714cbafc18a5a807b3cdd020043b62 Mon Sep 17 00:00:00 2001 From: Ethan Brown Date: Mon, 2 Sep 2024 16:50:04 -0700 Subject: [PATCH 4/4] docs: corrected example (#2717) * docs: made store consistent with examples in "Selecting multiple state slices" * docs: responded to review comments * Update readme.md * run pretiter --------- Co-authored-by: Daishi Kato Co-authored-by: daishi --- readme.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index f74c6a2892..3743a8ead1 100644 --- a/readme.md +++ b/readme.md @@ -91,9 +91,10 @@ import { create } from 'zustand' import { useShallow } from 'zustand/react/shallow' const useBearStore = create((set) => ({ - bears: 0, - increasePopulation: () => set((state) => ({ bears: state.bears + 1 })), - removeAllBears: () => set({ bears: 0 }), + nuts: 0, + honey: 0, + treats: {}, + // ... })) // Object pick, re-renders the component when either state.nuts or state.honey change @@ -110,7 +111,7 @@ const [nuts, honey] = useBearStore( const treats = useBearStore(useShallow((state) => Object.keys(state.treats))) ``` -For more control over re-rendering, you may provide any custom equality function. +For more control over re-rendering, you may provide any custom equality function (this example requires the use of [`createWithEqualityFn`](./docs/migrations/migrating-to-v5.md#using-custom-equality-functions-such-as-shallow)). ```jsx const treats = useBearStore(