score:0

import userEvent from "@testing-library/user-event";
import React, { useState } from "react";
import "./ExpenseItem.css";
   import ExpenseDate from "./ExpenseDate";
import Card from "../UI/Card";

const ExpenseItem = (props) => {
const [title, setTitle] = useState(props.title);

const clickHandeler = () => {
setTitle("Updated!");
   };

 return (
 <Card className="expense-item">
 <ExpenseDate date={props.date} />
 <div className="expense-item__description">
 <h2>{props.title}</h2>
  </div>
  <div className="expense-item__price">${props.amount}</div>
  <button onClick={clickHandeler}>Change Title</button>
  </Card>
   );
   };
  export default ExpenseItem;

Related Query

More Query from same tag