Guest User

Untitled

a guest
Mar 12th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. class Ausaf extends React.Component {
  2. constructor(props) {
  3. super(props);
  4. this.state = {
  5. firstname: "firstname",
  6. lastname: "lastname",
  7. fullname: "fullname",
  8. username: "username",
  9. password: "password",
  10. text: "text",
  11. class: "iput",
  12. divclass: "account",
  13. alertdemo: "this is demo",
  14. ausafasd: null,
  15. mod: "signin"
  16.  
  17. };
  18. this.signin = this.signin.bind(this);
  19. }
  20.  
  21. signup() {
  22. return(
  23. <div className={this.state.divclass}>
  24. <h1>Sign Up</h1>
  25. <input placeholder={this.state.username} type={this.state.text} className={this.state.class}/>
  26. <input placeholder={this.state.firstname} type={this.state.text} className={this.state.class}/>
  27. <input placeholder={this.state.lastname} type={this.state.text} className={this.state.class}/>
  28. <input placeholder={this.state.fullname} type={this.state.text} className={this.state.class}/>
  29. <input placeholder={this.state.password} type={this.state.password} className={this.state.class}/>
  30. <button> Sign UP</button>
  31. <a href="javascript:;" onClick={()=>{
  32. this.setState({mod: "signin"});
  33. }}>Sign in</a>
  34. </div>
  35. );
  36. }
  37.  
  38. signin() {
  39.  
  40. return(
  41. <div className={this.state.divclass}>
  42. <h1>Sign in</h1>
  43. <input placeholder={this.state.username} type={this.state.text} className={this.state.class}/>
  44. <input placeholder={this.state.password} type={this.state.password} className={this.state.class}/>
  45. <button onClick={()=>{
  46. this.setState({mod: "signup"});
  47. //alert("ausaf")
  48. }}>Sign In</button>
  49. <a href="javascript:;" onClick={()=>{
  50. this.setState({mod: "signup"});
  51. //alert("ausaf")
  52. }}>Sign in</a>
  53. </div>
  54. );
  55. }
  56.  
  57. ausafachat() {
  58. return(
  59. <div>
  60. <h1>This chat room For Ausaf</h1>
  61. <input placeholder={this.state.alertdemo}/>
  62. </div>
  63. );
  64. }
  65.  
  66. render(){
  67. switch(this.state.mod){
  68. case "signin": return(this.signin());
  69. break;
  70. case "signup": return(this.signup());
  71. break;
  72. }
  73.  
  74. }
  75.  
  76. }
  77.  
  78. ReactDOM.render(<Ausaf />, document.getElementById("root"));
Add Comment
Please, Sign In to add comment