Skip to content

Commit

Permalink
feat: add zustand
Browse files Browse the repository at this point in the history
  • Loading branch information
imkarimkarim committed Jan 9, 2025
1 parent 1417bc2 commit 962a104
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
31 changes: 30 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
16 changes: 16 additions & 0 deletions src/lib/store.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// global store/state

import { create } from "zustand";

export interface IStore {
count: number;
setCount: (value: number) => void;
}

export const useStore = create<IStore>(set => ({
count: 0,
setCount: value => set(() => ({ count: value })),
}));

// Example:
// const { count, setCount } = useStore();

0 comments on commit 962a104

Please sign in to comment.