diff --git a/react-complete-guide/src/components/Expenses/ExpenseItem.js b/react-complete-guide/src/components/Expenses/ExpenseItem.js index b1fac6d..1c88744 100644 --- a/react-complete-guide/src/components/Expenses/ExpenseItem.js +++ b/react-complete-guide/src/components/Expenses/ExpenseItem.js @@ -1,20 +1,26 @@ +import React, { useState } from 'react'; + import ExpenseDate from './ExpenseDate'; import Card from '../UI/Card'; import './ExpenseItem.css'; function ExpenseItem(props) { - /*const expenseDate = new Date(2023, 4, 28); - const expenseTitle = 'Car Insurance'; - const expenseAmount = 294.67;*/ + const [title, setTitle] = useState(props.title); + + const clickHandler = () => { + setTitle('Updated!'); + console.log(title); + }; return (
-

{props.title}

+

{title}

${props.amount}
+
); }