Skip to content

Commit

Permalink
feat: add a example store
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmeida00 committed Aug 15, 2023
1 parent 51c39fa commit aad3865
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/stores/useExampleStore.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { create } from 'zustand';

interface IPostsStore {
postsQuantity: number;
increase: (by: number) => void;
reset: () => void;
}

export const usePostsStore = create<IPostsStore>()((set) => ({
postsQuantity: 0,
increase: (by) =>
set((state) => ({ postsQuantity: state.postsQuantity + by })),
reset: () => set({ postsQuantity: 0 }),
}));

0 comments on commit aad3865

Please sign in to comment.