Skip to content

Commit

Permalink
chore: add pagination store
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimkyungmin123 committed May 3, 2023
1 parent 23c1b63 commit db719b0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/store/indes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { create } from "zustand";
import { persist } from "zustand/middleware";

interface PageState {
page: number;
setPage: (page: number) => void;
increasePage: (num: number) => void;
decreasePage: (num: number) => void;
}

export const usePageStore = create<PageState>()((set) => ({
page: 1,
setPage: (page) => set(() => ({ page })),
increasePage: (num) => set((state) => ({ page: state.page + num })),
decreasePage: (num) => set((state) => ({ page: state.page - num })),
}));

0 comments on commit db719b0

Please sign in to comment.