[英]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.