Last active
October 13, 2015 05:43
-
-
Save vistajess/c1073d7e89a41981a5c3 to your computer and use it in GitHub Desktop.
Sample React Redux
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 React from 'react'; | |
export default class AddForm extends React.Component { | |
state = { | |
txt: '' | |
} | |
render() { | |
return( | |
<div> | |
<form onSubmit={this.handleSubmit}> | |
<input type="text" onChange={this.handleChange}/> | |
<button>Add Text</button> | |
</form> | |
</div> | |
); | |
} | |
handleSubmit(e) { | |
e.preventDefault(); | |
//some codes here | |
} | |
handleChange(e) { | |
this.setState({ txt: e.target.value }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment