Skip to content

Commit 4371f7e

Browse files
committed
Handler function added to onclick event listener
1 parent f734e3d commit 4371f7e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/ToDo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const ToDo = ({ text, todos, setTodos, todo}: any) => {
1313
const ToDoCompleteHandler = function(): void {
1414

1515
setTodos(todos.map((t: any) => {
16-
16+
1717
if (t.id === todo.id) {
1818

1919
return {...t, completed: !t.completed}
@@ -30,7 +30,7 @@ const ToDo = ({ text, todos, setTodos, todo}: any) => {
3030

3131
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', transition: '1s ease-in-out' }} >
3232

33-
<li style={{ padding: '1rem' }}> {text} </li>
33+
<li className={` todo-task ${!todo.completed ? 'completed' : ''} `}> {text} </li>
3434
<button type='submit' className='complete-button' onClick={ToDoCompleteHandler}> <VscCheck /> </button>
3535
<button type='submit' className='trash-button' onClick={ToDoDeleteHandler}> <VscTrash /> </button>
3636

0 commit comments

Comments
 (0)