繁体   English   中英

no-unused-expressions:需要赋值或 function

[英]no-unused-expressions: Expected an assignment or function

我是全栈开发的新手,我正在尝试编写一些代码来更好地理解 React JS 和 Material UI 的前端。 在这个组件中,控制台在第 75 行给了我这个错误( this.props.isFriend(handle) ),但我不明白出了什么问题。

componentDidMount(){
    const {
      profile: { handle }
    } = this.props;
    
    this.props.isFriend(handle);
  }

我能怎么做?

此行在执行时返回一个值(可能是布尔值),但未使用它,这就是错误消息告诉您的内容。 您需要对返回的值做一些事情。

前任。

this.isFriend = this.props.isFriend(handle);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM