Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react';
  2.  
  3. class generalButton extends React.Component {
  4.     constructor(props : any) {
  5.         super(props);
  6.         this.state = { };
  7.  
  8.         // This binding is necessary to make `this` work in the callback
  9.         this.handleClick = this.handleClick.bind(this);
  10.     }
  11.     // Need to create usable functions to bind
  12.     handleClick() {
  13.         this.setState(state => ({/* bind to action*/ }));
  14.     }
  15.  
  16.     render() {
  17.         return (
  18.             <div>
  19.                 <h1> General Button </h1>
  20.                 <button
  21.                     style={{ height: "56px", width: "30%" }}
  22.                     onClick={this.handleClick}>
  23.                 </button>
  24.              </div>
  25.                );
  26.     }
  27. }
  28. export default generalButton;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement