refactor BudgetMonthCountContext to tsx (#1722)

* refactor BudgetMonthCountContext to tsx

* add release notes
This commit is contained in:
Joshua Krebs
2023-09-21 16:25:40 -07:00
committed by GitHub
parent 49ab358cf2
commit 2081e25cf5
3 changed files with 41 additions and 17 deletions

View File

@@ -1,17 +0,0 @@
import React, { createContext, useContext, useState } from 'react';
let BudgetMonthCountContext = createContext();
export function BudgetMonthCountProvider({ children }) {
let [displayMax, setDisplayMax] = useState(1);
return (
<BudgetMonthCountContext.Provider value={{ displayMax, setDisplayMax }}>
{children}
</BudgetMonthCountContext.Provider>
);
}
export function useBudgetMonthCount() {
return useContext(BudgetMonthCountContext);
}

View File

@@ -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);
}

View File

@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [Jod929]
---
Refactor budget/BudgetMonthCountContext to tsx.