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:
Danilo Britto 2025-04-15 17:10:09 -05:00 committed by GitHub
parent 473cfbf5ad
commit 21fc1b1522
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -8,6 +8,10 @@ nav: 25
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.
> [!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
const useSomeStore = createWithEqualityFn(stateCreatorFn, equalityFn)
```

View File

@ -8,6 +8,10 @@ nav: 29
`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.
> [!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
const someState = useStoreWithEqualityFn(store, selectorFn, equalityFn)
```