Skip to content

Commit

Permalink
Add a warning to readme about React Server Components (#2202)
Browse files Browse the repository at this point in the history
* Add a warning to readme about React Server Components

For more information, see #2200

* Use a softer, more succinct, formally worded warning

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
  • Loading branch information
ADTC and dai-shi authored Nov 24, 2023
1 parent a7b57b2 commit f5561df
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))

Expand Down

1 comment on commit f5561df

@vercel
Copy link

@vercel vercel bot commented on f5561df Nov 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.