简体   繁体   English

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

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

I'm new in full stack developing and I'm trying to code something to understand better frontend with React JS and Material UI.我是全栈开发的新手,我正在尝试编写一些代码来更好地理解 React JS 和 Material UI 的前端。 In this component, console give me this error at line 75( this.props.isFriend(handle) ) but I do not understand what is wrong.在这个组件中,控制台在第 75 行给了我这个错误( this.props.isFriend(handle) ),但我不明白出了什么问题。

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

How can I do?我能怎么做?

This line returns a value when it executes (probably a boolean), but it is not used, that's what the error message is telling you.此行在执行时返回一个值(可能是布尔值),但未使用它,这就是错误消息告诉您的内容。 You need to do something with the returned value.您需要对返回的值做一些事情。

Ex.前任。

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

暂无
暂无

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

相关问题 预期的赋值或函数调用:no-unused-expressions ReactJS 功能组件 - expected assignment or function call: no-unused-expressions ReactJS functional component 得到预期赋值或函数调用的错误,而是看到一个表达式 no-unused-expressions? - Getting the error that Expected an assignment or function call and instead saw an expression no-unused-expressions? 得到预期的赋值或函数调用的错误,而是在反应中看到了一个表达式 no-unused-expressions - getting an error of Expected an assignment or function call and instead saw an expression no-unused-expressions in react 期望一个赋值或函数调用,而是在React中看到一个表达式no-unused-expressions错误 - Expected an assignment or function call and instead saw an expression no-unused-expressions error in React Object.keys-需要一个赋值或函数调用,而是看到一个表达式no-unused-expressions - Object.keys - Expected an assignment or function call and instead saw an expression no-unused-expressions 如何解决这个 期望赋值或函数调用,而是看到一个表达式 no-unused-expressions - how to solve this Expected an assignment or function call and instead saw an expression no-unused-expressions 重定向(反应路由器dom),给出了期望的赋值或函数调用,而是看到了一个表达式no-unused-expressions - Redirect (react router dom) giving Expected an assignment or function call and instead saw an expression no-unused-expressions “预期分配或 function 调用,而是在我的聊天应用程序中看到一个表达式 no-unused-expressions” - “Expected an assignment or function call and instead saw an expression no-unused-expressions” in my chat app 在React中导入文件时,获得期望的赋值或函数调用,而是看到一个表达式no-unused-expressions - Getting Expected an assignment or function call and instead saw an expression no-unused-expressions, when import a file in React 反应:期望一个赋值或函数调用,而是看到一个表达式 no-unused-expressions - React: expected an assignment or function call and instead saw an expression no-unused-expressions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM