I'm trying to get the value of input onChange and I got really confused. (the function should take user input and display in html)
export class App extends React.Component {
constructor (props) {
super(props)
this.state = {
date: new Date(),
inputText: ''
}
this.handleChange = this.handleChange.bind(this)
this.submitChange = this.submitChange.bind(this)
}
handleChange (event) {
this.setState({
[event.target.name]: event.target.value
})
}
submitChange (event) {
event.preventDefault()
this.setState({
inputText: true
})
}
render () {
return (
<form onSubmit={this.submitChange}>
<input type='text' className='text_appoint' name='inputText' value={this.state.inputText} onChange={this.handleChange} placeholder='Typeing ...' />
</form>
<button className='submit' onClick={this.submitChange} value='Submit'>
<div> </div>