diff --git a/hooks/useTransactions.ts b/hooks/useTransactions.ts index ba43690..36a4684 100644 --- a/hooks/useTransactions.ts +++ b/hooks/useTransactions.ts @@ -34,10 +34,19 @@ export const useTransactions = () => { }); }, []); + const deleteTransaction = useCallback((id: string) => { + setTransactions((prev) => { + const updated = prev.filter((t) => t.id !== id); + AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(updated)); + return updated; + }); + }, []); + return { transactions, loading, addTransaction, + deleteTransaction, refresh: loadTransactions, }; }; \ No newline at end of file