Skip to content

Commit 228c44d

Browse files
v2 Delta 2.2
fixed the serial number issue. Now serial numbers will come from the index of that element rather than the id
1 parent 552eb05 commit 228c44d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/components/TaskCard.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React from 'react';
22

3-
const TaskCard = ({ task, deleteTaskById }) => {
3+
const TaskCard = ({ task, deleteTaskById, slnum }) => {
44
return (
55
<div>
6-
<div className='book-show' key={task.id}>
7-
{task.id}. {task.title}
6+
<div className='book-show'>
7+
<b>{slnum}. </b>
8+
{task.title}
89
<button onClick={() => deleteTaskById(task.id)}>delete</button>
910
</div>
1011
</div>

src/components/TaskList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import React from 'react';
22
import TaskCard from './TaskCard';
33

44
const TaskList = ({ tasks, deleteTaskById }) => {
5-
const renderTask = tasks.map((task) => {
5+
const renderTask = tasks.map((task, index) => {
66
return (
77
// <div key={task.id}>{task.id}. {task.title}</div>
8-
<TaskCard key={task.id} task={task} deleteTaskById={deleteTaskById} />
8+
<TaskCard key={task.id} task={task} slnum={index + 1} deleteTaskById={deleteTaskById} />
99
)
1010
})
1111
return (

0 commit comments

Comments
 (0)