Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Last active September 20, 2018 15:37
Show Gist options
  • Save ajcrites/b40cbad561945da5da7e3db67aa1ded0 to your computer and use it in GitHub Desktop.
Save ajcrites/b40cbad561945da5da7e3db67aa1ded0 to your computer and use it in GitHub Desktop.
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