Learning React using a Udemy course. Ran into the error while trying to output state value:
import React, {Component} from 'react';
// Create a new component and make this component produce some HTML
class SearchBar extends Component {
constructor(props) {
super(props);
this.state = {
term: ''
};
};
render() {
return (
<div>
<input onChange={this.onInputChange}></input>
Value of the input : {this.state.term}
</div>
);
};
onInputChange(event) {
this.setState({term: event.target.value})
}; }
export default SearchBar;
Could you please help explain the error?