Skip to content

Instantly share code, notes, and snippets.

@davelosert
Last active October 13, 2017 14:55
Show Gist options
  • Save davelosert/cd54ea3c953546904b2f0595f290e503 to your computer and use it in GitHub Desktop.
Save davelosert/cd54ea3c953546904b2f0595f290e503 to your computer and use it in GitHub Desktop.
Code Examples for a Blogpost
import {connect} from 'react-redux';
import {TodoList} from '../components/TodoList';
import {fetchAllTodos} from '../todo-repository/fetch-todos-thunk';
const mapStateToProps = ({loading, todos}) => {
return {
loading,
todos
};
};
const mapDispatchToProps = (dispatch) => {
return {
initTodos: () => dispatch(fetchAllTodos())
};
};
export default connect(mapStateToProps, mapDispatchToProps)(TodoList);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment