Created
September 15, 2017 17:05
-
-
Save Bastiani/3099e79e8d188cc8eef824ac3883ea35 to your computer and use it in GitHub Desktop.
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 { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
import * as actions from './actions'; | |
let createHandlers = function(dispatch) { | |
let onClick = function(node, data) { | |
dispatch(actions.nodeClicked(data)) | |
}; | |
return { | |
onClick, | |
// other handlers | |
}; | |
} | |
class Controls extends Component { | |
constructor(props) { | |
super(props); | |
this.handlers = createHandlers(this.props.dispatch); | |
} | |
render() { | |
// pass this.handlers anywhere you'd like | |
} | |
} | |
export default connect()(Controls); |
DEVGRID Test, Rafael Campos de Bastiani
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
teste devgrid, linux, react-native