/*
1. Import todos data from a JSON file
2. Load it into the component's state
3. map over the state object to display the todo items
*/
import React from "react";
import TodoItem from "./TodoItem";
import todosData from "./todosData";
class App extends React.Component {
constructor() {
super();
this.state = {
todos: todosData
};
}
render() {
const todoItems = this.state.todos.map(item => (
<TodoItem key={item.id} item={item} />
));
return <div className="todo-list">{todoItems}</div>;
}
}
export default App;