Please tell me on which line it’s wrong and what is wrong and tell me the answer to this question, so, that I can read and understand what’s going on. Your code so far
class ControlledInput extends React.Component {
constructor(props) {
super(props);
this.state = {
input: ''
};
// Change code below this line
this.handleChange = this.handleChange.bind(this)
// Change code above this line
}
// Change code below this line
handleChange(event){
this.setState({
input: event.target.value
});
}
// Change code above this line
render() {
return (
<div>
{ /* Change code below this line */}
<input value = {this.state.input}/>
{ /* Change code above this line */}
<h4>Controlled Input:</h4>
<p>{this.state.input}</p>
</div>
);
}
};
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36 Edg/90.0.818.51.
Could you tell me what to write and where to? i cannot understand as i have read your last response and other forums as well, if you could just give me the written solution, i will study it thoroughly and proceed further, i am just stuck on it for like two days. so if you can, just tell me what should be written.
Well, we don’t give people the answer, this is a learning site.
But you have a handler method called handleChange. You need to tell that input to run that method whenever there is a change. If you look into the link I provided, it gives this example:
Get help button used to do it for me, apparently this time its not there, thats why i asked, there are a lot of things which cannot be understood by those who dont have any sort of knowledge in new fields (including me) in some areas, some times an example is enough, i will use the example given by you to try it.