Skip to content

Instantly share code, notes, and snippets.

@vistajess
Last active October 13, 2015 05:43
Show Gist options
  • Save vistajess/c1073d7e89a41981a5c3 to your computer and use it in GitHub Desktop.
Save vistajess/c1073d7e89a41981a5c3 to your computer and use it in GitHub Desktop.
Sample React Redux
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