Skip to content

Commit

Permalink
Update README.md (#136)
Browse files Browse the repository at this point in the history
Ensure quantity is a number in ReadMe example, defaulting to 0 if undefined
  • Loading branch information
iamvinny authored Jul 10, 2024
1 parent 492e979 commit be94bd5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ function Cart() {
<li key={item.id}>
{item.quantity} x {item.name} &mdash;
<button
onClick={() => updateItemQuantity(item.id, item.quantity - 1)}
onClick={() => updateItemQuantity(item.id, (item.quantity ?? 0) - 1)}
>
-
</button>
<button
onClick={() => updateItemQuantity(item.id, item.quantity + 1)}
onClick={() => updateItemQuantity(item.id, (item.quantity ?? 0) + 1)}
>
+
</button>
Expand Down

0 comments on commit be94bd5

Please sign in to comment.