forked from njsh4261/swpp-react-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathTodoList.js
More file actions
25 lines (24 loc) · 741 Bytes
/
Copy pathTodoList.js
File metadata and controls
25 lines (24 loc) · 741 Bytes
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
import React, { Component } from 'react';
import './TodoList.css'
class TodoList extends Component {
state = {
todos: [
{ id: 1, title: 'SWPP', content: 'take swpp class', done: true},
{ id: 2, title: 'Movie', content: 'watch movie', done: false },
{ id: 3, title: 'Dinner', content: 'eat dinner', done: false },
],
}
render() {
const todos = this.state.todos.map((td) => {
return ( <Todo key={td.id} title={td.title}
done={td.done}/> );
});
return (
<div className='TodoList'>
<div className='title'>{this.props.title}</div>
<div className='todos'>{todos}</div>
</div>
);
}
}
export default TodoList