createContext from zustand/context
A special createContext is provided since v3.5,
which avoids misusing the store hook.
Note: This function is deprecated in v4 and will be removed in v5. See Migration.
createContext usage in real components
createContext usage with initialization from props
Migration
Discussion: https://github.com/pmndrs/zustand/discussions/1276
Here's the new context usage with v4 API.
Or reach out to some third-party libraries that provide Zustand v3-like APIs: