Moved todos to state

This commit is contained in:
Micah Godbolt
2019-02-12 15:52:32 -08:00
parent 5a87f131b5
commit ae89b3320a

View File

@@ -4,18 +4,21 @@ import { TodoHeader } from './components/TodoHeader';
import { TodoList } from './components/TodoList';
export class TodoApp extends React.Component {
export class TodoApp extends React.Component<any, any> {
constructor(props) {
super(props);
this.state = {
todos: [
{key: 1, text: 'Todo 1', completed: true},
{key: 2, text: 'Todo 2'},
{key: 3, text: 'Todo 3'},
{key: 4, text: 'Todo 4'},
],
filter: 'all'
}
}
render() {
const todos = [
{key: 1, text: 'Todo 1', completed: true},
{key: 2, text: 'Todo 2'},
{key: 3, text: 'Todo 3'},
{key: 4, text: 'Todo 4'},
];
const filter = 'all';
const {filter, todos} = this.state;
return (
<div>
<TodoHeader filter={filter} />