Skip to content

Commit

Permalink
refactor BudgetMonthCountContext to tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
Jod929 committed Sep 21, 2023
1 parent 49ab358 commit 80443fd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React, {
createContext,
type Dispatch,
type ReactNode,
type SetStateAction,
useContext,
useState,
} from 'react';

type BudgetMonthCountContextValue = {
displayMax: number;
setDisplayMax: Dispatch<SetStateAction<number>>;
};

let BudgetMonthCountContext = createContext<BudgetMonthCountContextValue>(null);

type BudgetMonthCountProviderProps = {
children: ReactNode;
};

export function BudgetMonthCountProvider({
children,
}: BudgetMonthCountProviderProps) {
let [displayMax, setDisplayMax] = useState(1);

return (
<BudgetMonthCountContext.Provider value={{ displayMax, setDisplayMax }}>
{children}
</BudgetMonthCountContext.Provider>
);
}

export function useBudgetMonthCount() {
return useContext(BudgetMonthCountContext);
}

0 comments on commit 80443fd

Please sign in to comment.