Files: 76f81afa54247dc961664e888a428d28dbffb096 / app / todos / containers / index.js
639 bytesRaw
1 | import React from 'react' |
2 | import { connect } from 'react-redux' |
3 | import { map, values } from 'ramda' |
4 | |
5 | import actions from '../actions' |
6 | import TodoList from '../components/todo-list' |
7 | import Todo from '../components/todo' |
8 | |
9 | class TodosContainer extends React.Component { |
10 | static fetchData = (getState, dispatch, location, params) => { |
11 | return dispatch(actions.find()) |
12 | } |
13 | |
14 | render () { |
15 | return <TodoList> |
16 | { |
17 | values(map(todo => { |
18 | return <Todo todo={todo} /> |
19 | }, this.props.todos)) |
20 | } |
21 | </TodoList> |
22 | } |
23 | } |
24 | |
25 | export default connect( |
26 | (state) => ({ |
27 | todos: state.todos.records |
28 | }) |
29 | )(TodosContainer) |
30 |
Built with git-ssb-web