class App extends React.Component {
constructor(props) {
super(props);
this.state = { inpVal: "" };
this.inputRef = React.createRef();
}
handleSubmit = (e) => {
e.preventDefault();
this.setState({ inpVal: this.inputRef.current.value });
};
render() {
return (
<form>
<h1>{this.state.inpVal}</h1>
<TextInput ref={this.inputRef} />
<button type="submit">Submit</button>
</form>
);
}
}
export default App;