mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
docs: update createWithEqualityFn and useStoreWithEqualityFn docs (#3084)
* Update create-with-equality-fn.md * Update use-store-with-equality-fn.md
This commit is contained in:
parent
473cfbf5ad
commit
21fc1b1522
@ -8,6 +8,10 @@ nav: 25
|
|||||||
However, it offers a way to define a custom equality check. This allows for more granular control
|
However, it offers a way to define a custom equality check. This allows for more granular control
|
||||||
over when components re-render, improving performance and responsiveness.
|
over when components re-render, improving performance and responsiveness.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> In order to use `createWithEqualityFn` from `zustand/traditional` you need to install
|
||||||
|
> `use-sync-external-store` library due to `zustand/traditional` relies on `useSyncExternalStoreWithSelector`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const useSomeStore = createWithEqualityFn(stateCreatorFn, equalityFn)
|
const useSomeStore = createWithEqualityFn(stateCreatorFn, equalityFn)
|
||||||
```
|
```
|
||||||
|
|||||||
@ -8,6 +8,10 @@ nav: 29
|
|||||||
`useStore`. However, it offers a way to define a custom equality check. This allows for more
|
`useStore`. However, it offers a way to define a custom equality check. This allows for more
|
||||||
granular control over when components re-render, improving performance and responsiveness.
|
granular control over when components re-render, improving performance and responsiveness.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> In order to use `useStoreWithEqualityFn` from `zustand/traditional` you need to install
|
||||||
|
> `use-sync-external-store` library due to `zustand/traditional` relies on `useSyncExternalStoreWithSelector`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const someState = useStoreWithEqualityFn(store, selectorFn, equalityFn)
|
const someState = useStoreWithEqualityFn(store, selectorFn, equalityFn)
|
||||||
```
|
```
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user