import React from 'react';
import './App.css';
interface Input{
input?:string;
}
class App extends React.Component<Input, any> {
constructor (props:any) {
super(props);
this.state = {
input: ''
}
}
onEventChange (e:any) {
this.setState({
input: e.target.value
})
}
render() {
return (
<div className="App">
<h1>Weather app</h1>
<input type="text" onChange={this.onEventChange.bind(this)} />
<h1>{this.state.input}</h1>
</div>
);
}
}
export default App;
What I am currently trying to do is validate the users Input. I am not sure how to move my interface into the state. Is this possible? I could not find a answer anywhere for this.