diff --git a/package-lock.json b/package-lock.json index 5027355..d34b508 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,8 @@ "tailwind-merge": "^2.6.0", "tailwindcss-animate": "^1.0.7", "tailwindcss-animated": "^1.1.2", - "yup": "^1.6.1" + "yup": "^1.6.1", + "zustand": "^5.0.3" }, "devDependencies": { "@eslint/js": "^9.17.0", @@ -4800,6 +4801,34 @@ "toposort": "^2.0.2", "type-fest": "^2.19.0" } + }, + "node_modules/zustand": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.3.tgz", + "integrity": "sha512-14fwWQtU3pH4dE0dOpdMiWjddcH+QzKIgk1cl8epwSE7yag43k/AD/m4L6+K7DytAOr9gGBe3/EXj9g7cdostg==", + "engines": { + "node": ">=12.20.0" + }, + "peerDependencies": { + "@types/react": ">=18.0.0", + "immer": ">=9.0.6", + "react": ">=18.0.0", + "use-sync-external-store": ">=1.2.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + }, + "use-sync-external-store": { + "optional": true + } + } } } } diff --git a/package.json b/package.json index cc3d747..94ae5cd 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "prepare": "husky" }, "dependencies": { - "@radix-ui/react-avatar": "^1.1.2", "@hookform/resolvers": "^3.10.0", + "@radix-ui/react-avatar": "^1.1.2", "@radix-ui/react-slot": "^1.1.1", "axios": "^1.7.9", "class-variance-authority": "^0.7.1", @@ -29,7 +29,8 @@ "tailwind-merge": "^2.6.0", "tailwindcss-animate": "^1.0.7", "tailwindcss-animated": "^1.1.2", - "yup": "^1.6.1" + "yup": "^1.6.1", + "zustand": "^5.0.3" }, "devDependencies": { "@eslint/js": "^9.17.0", diff --git a/src/lib/store.ts b/src/lib/store.ts new file mode 100644 index 0000000..ca5babc --- /dev/null +++ b/src/lib/store.ts @@ -0,0 +1,16 @@ +// global store/state + +import { create } from "zustand"; + +export interface IStore { + count: number; + setCount: (value: number) => void; +} + +export const useStore = create(set => ({ + count: 0, + setCount: value => set(() => ({ count: value })), +})); + +// Example: +// const { count, setCount } = useStore();