Refactor useBudgetState into smaller files

Refactors the `useBudgetState.ts` file into smaller, more manageable files to improve code organization and maintainability. No functionality is changed.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-16 05:49:41 +00:00
parent f98db16d17
commit 650bbf2f6f
6 changed files with 286 additions and 159 deletions

View File

@@ -0,0 +1,17 @@
import { useCallback } from 'react';
import { Transaction } from '../types';
import { calculateCategorySpending } from '../budgetUtils';
// 카테고리별 지출 계산 훅
export const useCategorySpending = (
transactions: Transaction[],
categoryBudgets: Record<string, number>
) => {
// 카테고리별 지출 계산
const getCategorySpending = useCallback(() => {
return calculateCategorySpending(transactions, categoryBudgets);
}, [transactions, categoryBudgets]);
return { getCategorySpending };
};