Guest User

Untitled

a guest
Oct 22nd, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. addValue(){
  2. console.log("add")
  3. }
  4.  
  5. import React from 'react'
  6.  
  7. export default class Button extends React.Component{
  8. constructor(props){
  9. super(props)
  10. this.action = this.action.bind(this);
  11. }
  12. action(e){
  13. // console.log(this.props.action)
  14. const {props} = this,{action = ()=>{}} = props;
  15. action()
  16. }
  17. render() {
  18. return (
  19. <button className={this.props.className} onClick={this.action}>{this.props.text}</button>
  20. )
  21. }
  22. }
Add Comment
Please, Sign In to add comment