
import { useCallback } from 'react';
import { Transaction } from '@/components/TransactionCard';

export const useTransactionsOperations = (
  transactions: Transaction[],
  setTransactions: React.Dispatch<React.SetStateAction<Transaction[]>>
) => {
  const updateTransaction = useCallback((updatedTransaction: Transaction) => {
    setTransactions(prev => 
      prev.map(t => t.id === updatedTransaction.id ? updatedTransaction : t)
    );
  }, [setTransactions]);

  return {
    updateTransaction
  };
};
