Typescript is not used. Why am I getting this error? It does not occur in any other component. I have looked at the answers of other questioners but have not found any useful information. Can someone please help me?
The corresponding errors occur at the constructor function location, the shouldComponentUpdate function location, and the render function location.
const RowTextarea = () => {
constructor(props){
super(props);
this.textArea = null;
}
shouldComponentUpdate(nextProps){
if(this.props.input.value !== nextProps.input.value){
if(isEmpty(nextProps.input.value)){
this.textArea.setAttribute('rows', this.props.rows);
}else{
this.textArea.setAttribute('rows', this.props.rows);
while(this.textArea.scrollHeight > this.textArea.offsetHeight){
const tempRows = Number(this.textArea.getAttribute('rows'));
this.textArea.setAttribute('rows', tempRows + 1);
}
}
}
}
return true;
};
Thank you all for sharing.
Changing from a function component to a class component worked. It was really helpful. Thank you very much.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.