Only handle onclick in the button instead of stopping propagation
This commit is contained in:
parent
1874dc4724
commit
1879caaa00
@ -117,8 +117,7 @@ function AddItemForm({ onNewItem }) {
|
|||||||
function ItemDisplay({ item, onItemUpdate, onItemRemoval }) {
|
function ItemDisplay({ item, onItemUpdate, onItemRemoval }) {
|
||||||
const { Container, Row, Col, Button } = ReactBootstrap;
|
const { Container, Row, Col, Button } = ReactBootstrap;
|
||||||
|
|
||||||
const toggleCompletion = (event) => {
|
const toggleCompletion = () => {
|
||||||
event.stopPropagation()
|
|
||||||
fetch(`/items/${item.id}`, {
|
fetch(`/items/${item.id}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
@ -153,7 +152,6 @@ function ItemDisplay({ item, onItemUpdate, onItemRemoval }) {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
onClick={toggleCompletion}
|
|
||||||
className={`far ${
|
className={`far ${
|
||||||
item.completed ? 'fa-check-square' : 'fa-square'
|
item.completed ? 'fa-check-square' : 'fa-square'
|
||||||
}`}
|
}`}
|
||||||
|
Loading…
Reference in New Issue
Block a user