简体   繁体   English

期望分配或 function 调用,而是看到一个表达式 @typescript-eslint/no-unused-expressions (React)

[英]Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions (React)

I am trying to run a fucntion on a click event with stopPropagation and its giving me error like: Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions我正在尝试使用stopPropagation对单击事件运行函数,它给我的错误如下: Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions

<span className="selectedValue" onClick={(e) => { e.stopPropagation(); runSelect;}}>25 Miles</span>

You're not actually calling runSelect .您实际上并没有调用runSelect Try this:尝试这个:

<span className="selectedValue" onClick={(e) => { e.stopPropagation(); runSelect();}}>25 Miles</span>

暂无
暂无

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

相关问题 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 得到预期的赋值或函数调用的错误,而是在反应中看到了一个表达式 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 重定向(反应路由器dom),给出了期望的赋值或函数调用,而是看到了一个表达式no-unused-expressions - Redirect (react router dom) giving Expected an assignment or function call and instead saw an expression 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 - Simple react component - Expected an assignment or function call and instead saw an expression no-unused-expressions 在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 反应中的 p5 js:期望赋值或函数调用,而是看到一个表达式 no-unused-expressions - p5 js in react : Expected an assignment or function call and instead saw an expression no-unused-expressions 期望一个赋值或 function 调用,而是在尝试使用 react 制作组件时看到一个表达式 no-unused-expressions - Expected an assignment or function call and instead saw an expression no-unused-expressions when trying to make a component using react
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM