Skip to content

Instantly share code, notes, and snippets.

@Jahans3
Last active July 17, 2017 18:48
Show Gist options
  • Save Jahans3/a2e191d7a9b5d84a5f82ca96c38066f2 to your computer and use it in GitHub Desktop.
Save Jahans3/a2e191d7a9b5d84a5f82ca96c38066f2 to your computer and use it in GitHub Desktop.
class MyContainer extends Component {
state = {
itemA: 'something',
itemB: 'another thing'
}
_onPress = () => {
// ...
}
_onPinch = () => {
// ...
}
_generateProps = () => ({
...this.props,
...this.state,
onPress: this._onPress,
onPinch: this._onPinch
})
render () {
const props = this._generateProps()
return (
<MyComponent {...props} />
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment