I am new to Reactjs and trying to change the of value text which is entered by user in textbox, after button click event. But after button click event I am getting error "TypeError: Cannot read property 'value' of undefined" at handleChange(e) function.Can anyone please help me with whats going wrong here??
Here is the component I am working with :
Constructor(props){
super();
this.state={
typedtext: 'Nothing'
}
};
handleClick(){
this.handleChange(this.state.typedtext)
}
handleChange(e){
this.setState({ typedtext: e.target.value });
}
render(){
return(
<div>
<label> Typed Value is : {this.state.typedtext} </label> <p>
</p>
<label> Type Something here </label>
<input type='text'onChange={(e)=>this.handleChange(e)}
value= {this.state.typedtext}/>
<button onClick={()=>this.handleClick()}> Copy Text </button>
</div>
);
}
}
constructormethod should start from lower casec