Skip to content

Instantly share code, notes, and snippets.

@davepoon
Created July 16, 2017 12:55
Show Gist options
  • Save davepoon/7b7dea8cf75eab8e5485279c4a44bbfc to your computer and use it in GitHub Desktop.
Save davepoon/7b7dea8cf75eab8e5485279c4a44bbfc to your computer and use it in GitHub Desktop.

Revisions

  1. davepoon created this gist Jul 16, 2017.
    33 changes: 33 additions & 0 deletions React Redux Container Component.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    import React, { PropTypes, Component } from 'react';
    import { connect } from 'react-redux';
    import { bindActionCreators } from 'redux';

    class $NAME extends Component {
    constructor(props, context) {
    super(props, context);
    }

    render() {
    return (

    );
    }
    }

    $NAME .propTypes = {
    actions: PropTypes.object.isRequired,
    };

    function mapStateToProps(state, ownProps) {
    return {
    state: state
    };
    }

    function mapDispatchToProps(dispatch) {
    return {
    actions: bindActionCreators(actions, dispatch)
    };
    }

    export default connect(mapStateToProps, mapDispatchToProps)($NAME);