diff --git a/packages/desktop-client/src/components/budget/BudgetMonthCountContext.js b/packages/desktop-client/src/components/budget/BudgetMonthCountContext.js deleted file mode 100644 index 4fda12ed7b2..00000000000 --- a/packages/desktop-client/src/components/budget/BudgetMonthCountContext.js +++ /dev/null @@ -1,17 +0,0 @@ -import React, { createContext, useContext, useState } from 'react'; - -let BudgetMonthCountContext = createContext(); - -export function BudgetMonthCountProvider({ children }) { - let [displayMax, setDisplayMax] = useState(1); - - return ( - - {children} - - ); -} - -export function useBudgetMonthCount() { - return useContext(BudgetMonthCountContext); -} diff --git a/packages/desktop-client/src/components/budget/BudgetMonthCountContext.tsx b/packages/desktop-client/src/components/budget/BudgetMonthCountContext.tsx new file mode 100644 index 00000000000..4a825f4ec20 --- /dev/null +++ b/packages/desktop-client/src/components/budget/BudgetMonthCountContext.tsx @@ -0,0 +1,35 @@ +import React, { + createContext, + type Dispatch, + type ReactNode, + type SetStateAction, + useContext, + useState, +} from 'react'; + +type BudgetMonthCountContextValue = { + displayMax: number; + setDisplayMax: Dispatch>; +}; + +let BudgetMonthCountContext = createContext(null); + +type BudgetMonthCountProviderProps = { + children: ReactNode; +}; + +export function BudgetMonthCountProvider({ + children, +}: BudgetMonthCountProviderProps) { + let [displayMax, setDisplayMax] = useState(1); + + return ( + + {children} + + ); +} + +export function useBudgetMonthCount() { + return useContext(BudgetMonthCountContext); +} diff --git a/upcoming-release-notes/1722.md b/upcoming-release-notes/1722.md new file mode 100644 index 00000000000..5eaca206e82 --- /dev/null +++ b/upcoming-release-notes/1722.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [Jod929] +--- + +Refactor budget/BudgetMonthCountContext to tsx. \ No newline at end of file