text: import React, { useState } from "react";
  import "./ExpenseForm.css";
  const ExpeseForm = (props) => {
    const [userInput, setUserInput] = useState({
      enteredtitle: "",
      enteredAmount: "",
      enteredDate: "",
    });
    const titleChangeHandler = (event) => {
      setUserInput((prevState) => {
        return { ...prevState, enteredtitle: event.target.value };
      });
    };
    const amountChangeHandler = (event) => {
      setUserInput((prevState) => {
        return { ...prevState, enteredAmount: event.target.value };
      });
    };
    const dateChangeHandler = (event) => {
      setUserInput((prevState) => {
        return { ...prevState, enteredDate: event.target.value };
      });
    };
    const submithandler = (event) => {
      event.preventDefault();
      const expenseData = {
        title: userInput.enteredtitle,
        amount: userInput.enteredAmount,
        date: new Date(userInput.enteredDate),
      };
      props.onSaveExpenseData(expenseData)
      setUserInput({
        enteredtitle: "",
        enteredAmount: "",
        enteredDate: "",
      });
  
      console.log("--------->", expenseData);
    };
    return (
      <form onSubmit={submithandler}>
        <div className="new-expense__controls">
          <div className="new-expense__control">
            <label> Title </label>
            <input
              type="text"
              value={userInput.enteredtitle}
              onChange={titleChangeHandler}
            />
          </div>
          <div className="new-expense__control">
            <label> Amount </label>
            <input
              type="number"
              min="0.01"
              step="0.01"
              value={userInput.enteredAmount}
              onChange={amountChangeHandler}
            />
          </div>
          <div className="new-expense__control">
            <label> Date </label>
            <input
              type="date"
              min="2019-01-01"
              step="2022-12-12"
              value={userInput.enteredDate}
              onChange={dateChangeHandler}
            />
          </div>
        </div>
        <div className="new-expense__action">
          <button type="submit">Add Expense</button>
        </div>
      </form>
    );
  };
  export default ExpeseForm;
  