Last active
May 8, 2018 15:09
-
-
Save clintonmedbery/ab5b692c5588c3d80fa83791c6f9b1ca to your computer and use it in GitHub Desktop.
ReactContainer Boilerplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
export const ThingComponent = ({ things, stuff}) => ( | |
<Container> | |
<form> | |
</form> | |
</Container> | |
); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { connect } from 'react-redux' | |
import { browserHistory } from 'react-router' | |
const mapStateToProps = (state, ownProps) => ({ | |
thing: state.thing | |
}); | |
const mapDispatchToProps = ({ | |
setThing | |
}); | |
const mergeProps = (stateProps, dispatchProps, ownProps) => ({ | |
...stateProps, | |
...dispatchProps, | |
...ownProps, | |
functionWeWantOurComponenetToHave: (param) => { | |
//Do Something with param | |
} | |
}); | |
class ThingContainerMixin extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
thing: '' | |
}; | |
} | |
componentWillMount () { | |
}; | |
componentWillUnmount () { | |
}; | |
render () { | |
return ( | |
<ThingComponent { ...this.props } | |
thing={this.state.thing} | |
/>; | |
}; | |
} | |
const ThingContainer = connect(mapStateToProps, mapDispatchToProps, mergeProps)(ThingContainerMixin); | |
export default ThingContainer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment