I want to execute a additional function in ReactJS onChange in input type text field, then render function is:
render(){
return (
<div>
<InputText />
</div>
)
}
The InputText component is:
class InputText extends React.Component {
onChange(e){
console.log("you typed again...");
}
render() {
return (
<input type="text" placeholder="search..." onChange={this.onChange()} />
);
}
}
The console log is to execute while user is typing but with my method the console log comes only if page is loaded.
What I have to fix there to get it runing if user start with typing?
onChange={this.onChange}, without()