Skip to content

Instantly share code, notes, and snippets.

@isnifer
Created July 29, 2015 16:14
Show Gist options
  • Save isnifer/e2abf3869ce3dd998a46 to your computer and use it in GitHub Desktop.
Save isnifer/e2abf3869ce3dd998a46 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { Connector } from 'redux/react';
import Header from '../components/Header';
import MainSection from '../components/MainSection';
import * as TodoActions from '../actions/TodoActions';
export default class TodoApp extends Component {
render() {
return (
<Connector select={state => ({ todos: state.todos })}>
{this.renderChild}
</Connector>
);
}
renderChild({ todos, dispatch }) {
const actions = bindActionCreators(TodoActions, dispatch);
return (
<div>
<Header addTodo={actions.addTodo} />
<MainSection todos={todos} actions={actions} />
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment