This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TodoApp extends Component { | |
render() { | |
return ( | |
<div className="todos"> | |
<Grid columns={1} className="ui center aligned"> | |
<Grid.Row> | |
<Grid.Column className="todo-body" width={12}> | |
<h2>Simple Todo</h2> | |
<TodoInput /> | |
<div id="display-todos"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TodoInput = props => { | |
let todo; | |
return ( | |
<AppConsumer> | |
{({ addTodo }) => ( | |
<form | |
onSubmit={e => { | |
e.preventDefault(); | |
}} | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DisplayTodos = props => { | |
return ( | |
<AppConsumer> | |
{({ todos, completed }) => { | |
const notCompleted = todos.filter(todo => { | |
if (todo.completed === false) { | |
return todo; | |
} | |
}); |
OlderNewer