Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react';
- class LoginForm extends React.Component {
- constructor() {
- super();
- this.state = {
- username: '',
- password: '',
- }
- this.handleChange = this.handleChange.bind(this);
- this.handleSubmit = this.handleSubmit.bind(this);
- }
- handleChange(event) {
- // onChange Event logic
- }
- handleSubmit(event) {
- // onSubmit Event logic
- }
- render() {
- return (
- <form> {/* Don't worry about a method or action for now */}
- <label htmlFor="username">Username: </label>{/* 'for' is a reserved word in JS, so in JSX we have to use htmlFor */}
- <input name="username" type="text" />
- <label htmlFor="password">Password: </label>
- <input name="password" type="password" />
- <button>Submit</button>
- </form>
- );
- }
- }
Add Comment
Please, Sign In to add comment