Only handle onclick in the button instead of stopping propagation

This commit is contained in:
Ivan Deskov 2020-05-24 21:12:06 +01:00
parent 1874dc4724
commit 1879caaa00
1 changed files with 1 additions and 3 deletions

View File

@ -117,8 +117,7 @@ function AddItemForm({ onNewItem }) {
function ItemDisplay({ item, onItemUpdate, onItemRemoval }) {
const { Container, Row, Col, Button } = ReactBootstrap;
const toggleCompletion = (event) => {
event.stopPropagation()
const toggleCompletion = () => {
fetch(`/items/${item.id}`, {
method: 'PUT',
body: JSON.stringify({
@ -153,7 +152,6 @@ function ItemDisplay({ item, onItemUpdate, onItemRemoval }) {
}
>
<i
onClick={toggleCompletion}
className={`far ${
item.completed ? 'fa-check-square' : 'fa-square'
}`}