Skip to content

Navigation Menu

Sign in
Sign up

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      AltStyle によって変換されたページ (->オリジナル) /