-
-
Notifications
You must be signed in to change notification settings - Fork 204
Zustand deprecation warning: Use createWithEqualityFn instead of create #493
Open
Description
Description
When using @react-three/xr with zustand v5, the following console warning appears:
[DEPRECATED] Use createWithEqualityFn instead of create or use useStoreWithEqualityFn instead of useStore. They can be imported from 'zustand/traditional'. pmndrs/zustand#1937
Environment
- @react-three/xr: 6.6.29
- zustand: 5.0.11
- Browser: Chrome
Expected behavior
No deprecation warnings in the console.
Suggested fix
Per pmndrs/zustand#1937, stores using equality functions should migrate from:
import { create } from 'zustand' const useStore = create((set) => ({ ... }), Object.is)
to:
import { createWithEqualityFn } from 'zustand/traditional' const useStore = createWithEqualityFn((set) => ({ ... }), Object.is)
Similarly, useStore with an equality function should use useStoreWithEqualityFn from zustand/traditional.
Sources:
Activity
Metadata
Metadata
Assignees
Labels
No labels