Guest User

Untitled

a guest
Feb 8th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. /**
  2. * @jsx React.DOM
  3. */
  4.  
  5. var loginForm = React.createClass({
  6. getInitialState: function() {
  7. return {loggedIn : false};
  8. },
  9. login : function(event) {
  10. alert('logging in');
  11. },
  12. logout : function(event) {
  13. alert('logging out');
  14. },
  15. render: function() {
  16. return (
  17. <div>
  18. <form /*action={this.server+'/login.php'}*/>
  19. <label htmlFor="username">Username:</label>
  20. <input type="text" id="username" name="username" />
  21. <label htmlFor="password">Password:</label>
  22. <input type="password" id="password" name="password" />
  23. </form>
  24. </div>
  25. <div>
  26. <button onClick={this.login}> Login </button>
  27. <button onClick={this.logout}> Logout </button>
  28. </div>
  29. )
  30. }
  31.  
  32.  
  33.  
  34. });
  35.  
  36. React.renderComponent(
  37. <loginForm />,
  38. document.body
  39. );
  40.  
  41. <div>
  42. <form /*action={this.server+'/login.php'}*/>
  43. <label htmlFor="username">Username:</label>
  44. <input type="text" id="username" name="username" />
  45. <label htmlFor="password">Password:</label>
  46. <input type="password" id="password" name="password" />
  47. </form>
  48. <div>
  49. <button onClick={this.login}> Login </button>
  50. <button onClick={this.logout}> Logout </button>
  51. </div>
  52. </div>
Add Comment
Please, Sign In to add comment