mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
fix(docs): Update usage without React on recipes.mdx (#2047)
* Update usage without React on recipes.mdx Makes recipes.mdx usage without React inline with the readme.md description, because the current recipes.mdx usage is deprecated * Update docs/recipes/recipes.mdx Change copy Co-authored-by: Blazej Sewera <code@sewera.dev> * remove empty line on recipes.mdx --------- Co-authored-by: Blazej Sewera <code@sewera.dev>
This commit is contained in:
parent
f3a0fd802b
commit
deba6ed0d0
@ -183,13 +183,13 @@ const store = createStore(() => ({ ... }))
|
||||
const { getState, setState, subscribe, destroy } = store
|
||||
```
|
||||
|
||||
You can even consume an existing vanilla store with React:
|
||||
You can use a vanilla store in React with a `useStore` hook.
|
||||
|
||||
```jsx
|
||||
import { create } from 'zustand'
|
||||
import { useStore } from 'zustand'
|
||||
import { vanillaStore } from './vanillaStore'
|
||||
|
||||
const useStore = create(vanillaStore)
|
||||
const useBoundStore = (selector) => useStore(vanillaStore, selector)
|
||||
```
|
||||
|
||||
## Transient updates (for frequent state changes)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user