Facebook
From Sludgy Agouti, 2 Months ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 52
  1. import React, { SyntheticEvent } from 'react';
  2. import { useDispatch } from 'react-redux';
  3.  
  4. import { addTransactions } from 'reducers/TransactionsReducer';
  5. import ITransaction from 'types/ITransaction.interface';
  6.  
  7. function AddForm() {
  8.     const dispatcher = useDispatch();
  9.  
  10.     const handleSubmit = (e: SyntheticEvent): void => {
  11.         e.preventDefault();
  12.  
  13.         let newTransaction: ITransaction = {
  14.             name: transaction_name,
  15.             amount_euro: amount      
  16.         };
  17.        
  18.         dispatcher(addTransactions(newTransaction));
  19.     };
  20.    
  21.     return (
  22.                 smth to return
  23.         );
  24. }
  25.  
  26. export default AddForm;
  27.