From f5561dfb05babb89773128d00fabda74ddd145d4 Mon Sep 17 00:00:00 2001 From: ADTC Date: Fri, 24 Nov 2023 23:01:24 +0800 Subject: [PATCH] Add a warning to readme about React Server Components (#2202) * Add a warning to readme about React Server Components For more information, see https://github.com/pmndrs/zustand/discussions/2200 * Use a softer, more succinct, formally worded warning --------- Co-authored-by: Daishi Kato --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 9abc9fadf1..1a1b3fd301 100644 --- a/readme.md +++ b/readme.md @@ -164,6 +164,8 @@ const useSoundStore = create((set, get) => ({ Sometimes you need to access state in a non-reactive way or act upon the store. For these cases, the resulting hook has utility functions attached to its prototype. +:warning: This technique is not recommended for adding state in [React Server Components](https://github.com/reactjs/rfcs/blob/main/text/0188-server-components.md) (typically in Next.js 13 and above). It can lead to unexpected bugs and privacy issues for your users. For more details, see [#2200](https://github.com/pmndrs/zustand/discussions/2200). + ```jsx const useDogStore = create(() => ({ paw: true, snout: true, fur: true }))