Advertisement
Guest User

Untitled

a guest
Aug 27th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. import React, { Component } from 'react';
  2.  
  3. export default class Login extends Component {
  4. constructor(props){
  5. super(props);
  6. this.state={
  7. username: '',
  8. password: ''
  9. }
  10. this.handleInputChange = this.handleInputChange.bind(this);
  11. }
  12.  
  13. handleInputChange(event) {
  14. const username = event.target.username;
  15. const password = event.target.password;
  16.  
  17. this.setState({
  18. [name]: value
  19. });
  20. }
  21.  
  22. render(){
  23. return(
  24. <div>
  25. <form>
  26. <div className="form-group">
  27. <input value={this.state.username} onChange={this.handleInputChange} className="form-control" type="text" name="email" placeholder="Enter email"/>
  28. </div>
  29. <div className="form-group">
  30. <input value={this.state.password} onChange={this.handleInputChange} className="form-control" type="password" name="password" placeholder="Password"/>
  31. </div>
  32. <button className="btn btn-primary" type="submit">Login</button>
  33. </form>
  34. </div>
  35. )
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement