Last active
July 10, 2016 15:12
-
-
Save daslicht/770daeb343e829713148a7e69fe21072 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 * as React from "react"; | |
| export interface CommentFormProps { } | |
| export interface CommentFormAppState {author:any,text:any } | |
| export class CommentForm extends React.Component<CommentFormProps, CommentFormAppState>{ | |
| constructor(props: any) { | |
| super(props); | |
| this.state = { author: '', text: '' }; | |
| } | |
| handleAuthorChange(e:CommentFormAppState) { | |
| this.setState({ author: e.target.value }); | |
| } | |
| handleTextChange(e) { | |
| this.setState({ text: e.target.value }); | |
| } | |
| render() { | |
| return ( | |
| <form className="commentForm"> | |
| <input | |
| type="text" | |
| placeholder="Your name" | |
| value={this.state.author} | |
| onChange={this.handleAuthorChange} | |
| /> | |
| <input | |
| type="text" | |
| placeholder="Say something..." | |
| value={this.state.text} | |
| onChange={this.handleTextChange} | |
| /> | |
| <input type="submit" value="Post" /> | |
| </form> | |
| ); | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment