Answer the question
In order to leave comments, you need to log in
Cannot read property 'props' of undefined?
When entering into a textarea, an error pops up:
Cannot read property 'props' of undefined
class Mes1 extends React.Component{
constructor(props) {
super(props)
this.props = props;
window.two = props; // пропсы приходят
};
changePostText(e)
{
console.log(e.target.value);
let text = e.target.value;
this.props.changePostText(text); // can't read property 'props' of undefined
}
render()
{
return (
<div>
<textarea onChange={this.changePostText} value={this.props.postText} />
</div>
)}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question