Last active
May 1, 2018 16:30
-
-
Save awareness481/fee616472c7e973b01993aa80c934797 to your computer and use it in GitHub Desktop.
This file contains 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 Action extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
val: '' | |
} | |
this.handleAction = this.handleAction.bind(this); | |
this.handleChange = this.handleChange.bind(this); | |
} | |
handleAction (e) { | |
e.preventDefault(); | |
return e.target.query.value; | |
} | |
handleChange(e) { | |
this.setState({ val: e.target.query.value}); | |
} | |
render() { | |
return ( | |
<div> | |
<form onSubmit={this.handleAction}> | |
<input type='text' name='query' value={this.state.val} onChange={this.handleChange}/> | |
</form> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment