簡體   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)

我正在嘗試使用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>

您實際上並沒有調用runSelect 嘗試這個:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM