Skip to content

Instantly share code, notes, and snippets.

@kaiobrito
Created July 20, 2018 20:46
Show Gist options
  • Save kaiobrito/b0167a142a04e67741694af451137fdf to your computer and use it in GitHub Desktop.
Save kaiobrito/b0167a142a04e67741694af451137fdf to your computer and use it in GitHub Desktop.
TodoList + Redux
class TodoList extends React.Component {
static defaultProps = {
todos: {}
};
render() {
return (
<ul>
{this.props.todos
.valueSeq()
.map(todo => <li key={todo.get("id")}>{todo.get("text")}</li>)}
</ul>
);
}
}
const mapStateToProps = state => {
return {
todos: state.todos.get("items")
};
};
export default connect(mapStateToProps)(TodoList);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment