Skip to content

Commit

Permalink
refactor BudgetMonthCountContext to tsx (#1722)
Browse files Browse the repository at this point in the history
* refactor BudgetMonthCountContext to tsx

* add release notes
  • Loading branch information
Jod929 authored Sep 21, 2023
1 parent 49ab358 commit 2081e25
Show file tree
Hide file tree
Showing 3 changed files with 41 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);
}
6 changes: 6 additions & 0 deletions upcoming-release-notes/1722.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [Jod929]
---

Refactor budget/BudgetMonthCountContext to tsx.

0 comments on commit 2081e25

Please sign in to comment.