Skip to content

Instantly share code, notes, and snippets.

@dane-stevens
Last active July 10, 2018 20:55
Show Gist options
  • Select an option

  • Save dane-stevens/c4f4b3e70d5e1e5d6e772fa4ff58e26c to your computer and use it in GitHub Desktop.

Select an option

Save dane-stevens/c4f4b3e70d5e1e5d6e772fa4ff58e26c to your computer and use it in GitHub Desktop.
import React from "react";
class Button extends React.Component {
constructor(props) {
super(props);
this.state = {
disabled: false
};
this.handleClick = this.handleClick.bind(this);
}
handleClick = () => {
this.setState({
disabled: true
});
};
render() {
return (
<button onClick={this.handleClick} disabled={this.state.disabled}>
{this.props.children}
</button>
);
}
}
export default Button;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment