-
Notifications
You must be signed in to change notification settings - Fork 19
/
Todos.js
36 lines (31 loc) · 913 Bytes
/
Todos.js
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
26
27
28
29
30
31
32
33
34
35
36
import Inferno from 'inferno'
import Component from 'inferno-component'
import { connect } from 'inferno-mobx'
import TodoAdd from '../components/todos/TodoAdd'
import TodoItem from '../components/todos/TodoItem'
@connect(['todos'])
class Todos extends Component {
// When route is loaded (isomorphic)
static onEnter({ todos, common, params }) {
common.title = 'Home'
return todos.browse()
}
render({ todos }) {
return <main>
<h1>todos</h1>
<div className="home">
<TodoAdd/>
<section className="main">
<TodoItemWrapper todos={todos}/>
</section>
</div>
</main>
}
}
// Render each item
const TodoItemWrapper = connect(props => (
<ul className="todo-list">
{props.todos.map(item => <TodoItem item={item}/>)}
</ul>
))
export default Todos