Skip to content

Commit

Permalink
Add a warning to readme about React Server Components (pmndrs#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 pmndrs#2200

* Use a softer, more succinct, formally worded warning

---------

Co-authored-by: Daishi Kato <[email protected]>
  • 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

0 comments on commit f5561df

Please sign in to comment.