Skip to content

Instantly share code, notes, and snippets.

@Azerothian
Last active May 27, 2016 01:43
Show Gist options
  • Save Azerothian/2235b5f80e4b881debb9fb8ba80a4359 to your computer and use it in GitHub Desktop.
Save Azerothian/2235b5f80e4b881debb9fb8ba80a4359 to your computer and use it in GitHub Desktop.
import React from "react"
export default React.createClass({
getInitialState() {
return {
displayState: "confimination",
}
},
handleButtonClick(displayState) {
return () => {
return this.setState({displayState});
}
},
render() {
switch(this.state.displayState) {
case "confirmation":
return (<button onClick={this.handleButtonClick("success")}>{"Confirmation"}</button>);
case "error":
return (<button onClick={this.handleButtonClick("confirmation")}>{"Error"}</button>);
case "success":
return (<button onClick={this.handleButtonClick("error")}>{"Success"}</button>);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment