Skip to content

Instantly share code, notes, and snippets.

@srossross
Last active March 17, 2017 02:58
Show Gist options
  • Save srossross/fb5ccb659988bb04d2b5dd4d4dc8d5eb to your computer and use it in GitHub Desktop.
Save srossross/fb5ccb659988bb04d2b5dd4d4dc8d5eb to your computer and use it in GitHub Desktop.
function mapStateToProps(state) {
return {
value: state.blackbox.value
}
}
function mapDispatchToPops(dispatch) {
return {
setLHS: () => null, // TBD
setRHS: () => null, // TBD
}
}
@ReactRedux.connect(mapStateToProps, mapDispatchToPops)
class MyComponent extends React.Component {
render() {
return (<div>
The value of the external component is
<span className="ripple"> {this.props.value} </span>
<br/>
<hr/>
<button className="ripple" onClick={this.props.setLHS}>
Set LHS to 2
</button>
<br/>
<button className="ripple" onClick={this.props.setRHS}>
Set RHS to 99
</button>
</div>);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment