Skip to content

Instantly share code, notes, and snippets.

@gonzalolarrosa
Created August 1, 2018 19:50
Show Gist options
  • Save gonzalolarrosa/6fffdcfef4a0aa1644ccadcd35eab662 to your computer and use it in GitHub Desktop.
Save gonzalolarrosa/6fffdcfef4a0aa1644ccadcd35eab662 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import './main-component.css';
import ChildComponent from './ChildComponent';
export default class MainComponent extends Component {
constructor (props) {
super(props);
this.label = “I’m your father”;
};
onSubmit = (option) => (option === “I’m your father” ? ‘cool’ : ‘not cool’);
render () {
return(
<div className="container">
<ChildComponent label={this.label} onSubmit={this.onSubmit} />
</div>
);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment