immer'ified

This commit is contained in:
Ken
2019-01-30 15:06:03 -08:00
parent c44af2a38f
commit e3e977a98d
5 changed files with 33 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ import { TodoItem, FilterTypes } from '../store';
export interface TodoListProps {
todos: { [id: string]: TodoItem };
filter: FilterTypes;
complete: (id: string) => void;
}
export class TodoList extends React.Component<TodoListProps> {
@@ -15,7 +16,7 @@ export class TodoList extends React.Component<TodoListProps> {
<Stack verticalGap={10}>
{Object.keys(todos).map(id => {
const todo = todos[id];
return <TodoListItem key={id} checked={todo.completed} label={todo.label} />;
return <TodoListItem key={id} checked={todo.completed} label={todo.label} complete={this.props.complete} id={id} />;
})}
</Stack>
);