Skip to content

Instantly share code, notes, and snippets.

@HyunSeob
Created July 15, 2018 05:34
Show Gist options
  • Save HyunSeob/c508e629f8b0802d6017c6a2cbff0b9d to your computer and use it in GitHub Desktop.
Save HyunSeob/c508e629f8b0802d6017c6a2cbff0b9d to your computer and use it in GitHub Desktop.
import React from 'react';
import { render } from 'react-dom';
class Button extends React.Component {
handleClick = () => {
this.props.onClick(this.props.value)
}
render() {
return <button {...this.props} onClick={this.handleClick} />
}
}
render((
<Button
value="Hello"
onClick={() => console.log(value + ', world!')}
>
Button
</Button>
), document.getElementById('root'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment