Skip to content

Commit

Permalink
Switched changeHandler to function expression
Browse files Browse the repository at this point in the history
  • Loading branch information
andiedoescode committed Mar 3, 2024
1 parent e60a4e8 commit d8346dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/ListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function ListItem({ listPath, item }) {
}, [item.dateLastPurchased]);

const [isChecked, setIsChecked] = useState(purchasedOneDayAgo);
function changeHandler(e) {
const changeHandler = (e) => {
setIsChecked(!isChecked);
async function purchaseItem() {
try {
Expand All @@ -31,7 +31,7 @@ export function ListItem({ listPath, item }) {
}
}
purchaseItem();
}
};

//sets a timer to uncheck an item 24 hours after it's purchased
useEffect(() => {
Expand Down

0 comments on commit d8346dc

Please sign in to comment.