Last active
September 20, 2018 15:37
-
-
Save ajcrites/b40cbad561945da5da7e3db67aa1ded0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
export class FunctionWithArgumentsComponent extends React.Component { | |
doSomethingWithColor = color => () => {}; | |
style = { color: this.props.color }; | |
render() { | |
return <View style={this.style} onPress={this.doSomethingWithColor(this.props.color)} />; | |
} | |
} | |
// -- Or as a stateless functional component -- | |
const doSomethingWithColor = color => () {}; | |
const style = {}; | |
export const FunctionWithArgumentsSFC: React.SFC = ({ color }) => { | |
style.color = color; | |
return <View style={style} onPress={doSomethingWithColor(color)} />; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment