Currently when I try to use any sort of Zustand state, even from the docs, I get an error saying Missing "./react" export in "zustand" package
. I am using Vite and TypeScript.
const bears = useBearStore((state) => state.bears);
useEffect(() => {
console.log(bears);
}, []);
Here is my vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import * as path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }],
},
});
Check your import. It should be:
import create from 'zustand';