简体   繁体   English

未使用的表达式,预期的赋值或函数调用

[英]unused expression, expected an assignment or function call

I am new to react. 我是新来的反应。 I am getting error on compile "unused expression, expected an assignment or function call" in the following code for button onClick. 我在以下代码中为按钮onClick编译“未使用的表达式,预期的赋值或函数调用”时出错。

handleClick = (itemClicked:PaymentTypes, e) => {
    <Route exact path="/ListSwipe" render={(props) =>  ( <ListSwipe vpType={itemClicked}/> )} />
}

I don't know your intention to use handleClick function to use like that but the warning ( It shouldn't be an error, maybe a linter error) you have because of you are neither returning anything nor invoking a function here. 我不知道您打算使用handleClick函数来那样使用,但由于您既未返回任何内容也不在此处调用函数,因此发出警告(这应该不是错误,可能是linter错误)。 Try to use it like this: 尝试像这样使用它:

handleClick = (itemClicked:PaymentTypes, e) =>
    <Route exact path="/ListSwipe" render={(props) =>  ( <ListSwipe vpType={itemClicked}/> )} />

暂无
暂无

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

相关问题 预期分配或 function 调用,而是看到一个表达式:没有未使用的表达式 - Expected an assignment or function call and instead saw an expression : no unused expression 如何解决“未使用的表达式,预期的赋值或函数调用”问题? - How to resolve the issue “unused expression, expected an assignment or function call”? 错误:需要赋值或函数调用,但看到的是表达式 no-unused-expressions。 如何解决? - Error: Expected an assignment or function call and instead saw an expression no-unused-expressions. How to solve it? 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 第 103:9 行:期望赋值或函数调用,却看到了一个表达式 no-unused-expressions - Line 103:9: Expected an assignment or function call and instead saw an expression no-unused-expressions IONIC / REACT 第 9:5 行:期望一个赋值或函数调用,而是看到一个表达式 @typescript-eslint/no-unused-expressions - IONIC / REACT Line 9:5: Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions React JS - 错误 - 需要赋值或 function 调用,而是看到一个表达式 no-unused-expressions - React JS - Error - 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
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM