I understand the three fixes (binding, arrow function method, arrow function for call back) for this error but am still getting error after using arrow function on the method. Error: _this.props.onSubmit is not a function" Please see below. Thanks.
import React from 'react';
import ReactDOM from 'react-dom'
var clickstyle = {
color: "black",
fontSize: 28,
margin: 15,
}
class Click extends React.Component {
state = { term: 'Say Something!' };
onFormSubmit = (event) => {
event.preventDefault();
this.props.onSubmit(this.state.term);
}
render() {
return (
<div className="ui segment">
<form onSubmit={this.onFormSubmit} className="ui form">
<div className="field">
<label style={clickstyle}> Say It!</label>
<input
type="text"
value={this.state.term}
onChange={(e) =>
this.setState({ term: e.target.value.toUpperCase() })}
/>
</div>
</form>
</div>
)
}
}
export default Click;