Created
August 1, 2018 20:00
-
-
Save gonzalolarrosa/f6d57d37d659e40e5f85440267c33199 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 React, { Component } from 'react'; | |
import { string, func } from 'prop-types'; | |
import './child-component.css'; | |
export default class ChildComponent extends Component { | |
static propTypes = { | |
label: string, | |
onSubmit: func.isRequired | |
}; | |
static defaultProps = { | |
label: “I’m your son” | |
}; | |
constructor (props) { | |
super(props); | |
}; | |
onClick = () => (onSubmit(this.props.label)); | |
render () { | |
const { onSubmit, label} = this.props; | |
return( | |
<div className="container"> | |
<Button onClick={onClick()}>{label}</Button> | |
</div> | |
); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment