-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSingleTodo.jsx
More file actions
31 lines (27 loc) · 1.27 KB
/
Copy pathSingleTodo.jsx
File metadata and controls
31 lines (27 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { Component } from "react";
class SingleTodos extends Component{
//below function is used to export data from child to parent using (prop.function_name) which is set in parent
mkcDelete=()=>{
this.props.delete(this.props.todoItem.id)
}
//below function is used to export data from child to parent using (prop.function_name) which is set in parent
bcisDone=()=>{
this.props.isDone(this.props.todoItem.id)
}
render(){
return (
<div className="container">
<div className="row">
<div className="col-md-1"><strong>{this.props.index}</strong></div>
<div className="col-md-1"><input type="checkbox" onChange={this.bcisDone} checked={this.props.todoItem.isDone}/></div>
<div style={{textDecoration: this.props.todoItem.isDone ? 'line-through':''}} className="col-md-6"><strong>
{/* binding of data */}
{this.props.todoItem.value}</strong></div>
<div className="col-md-4 mb-1"><button className="btn btn-danger"onClick={this.mkcDelete}>Delete</button>
</div>
</div>
</div>
)
}
}
export default SingleTodos;