Last active
May 27, 2016 01:43
-
-
Save Azerothian/2235b5f80e4b881debb9fb8ba80a4359 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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