Skip to content

Instantly share code, notes, and snippets.

@gdyrrahitis
Created May 9, 2018 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gdyrrahitis/cf4a22ba4e0ab31cb1cbe072071025b5 to your computer and use it in GitHub Desktop.
Save gdyrrahitis/cf4a22ba4e0ab31cb1cbe072071025b5 to your computer and use it in GitHub Desktop.
import React from "react";
import ReactDOM from "react-dom";
export class NameForm extends React.Component {
constructor(props) {
super();
this.props = props;
}
render() {
const store = this.props.store;
const value = store.getState();
return <form>
<div className="form-group">
<input placeholder="Enter your name"
className="form-control" type="text"
value={value}
onChange={(event) => {
store.dispatch({
type: "NAME_CHANGE",
value: event.target.value
})
}} />
</div>
</form>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment