You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React 18升级后缺失'onPointerEnterCapture'和'onPointerLeaveCapture'属性的解决办法咨询

React 18升级后缺失'onPointerEnterCapture'和'onPointerLeaveCapture'属性的解决办法咨询

我打算把自己的项目从React 17升级到React 18,结果更新之后碰到了一个报错:

Property 'onPointerEnterCapture' is missing in type

要是直接给这两个属性赋值undefined的话,代码能正常运行,但总觉得这么写很不美观。有没有什么办法可以不用写undefined就能解决这个问题呢?

目前我用的临时解决方案是这样的:

onPointerEnterCapture={undefined}
onPointerLeaveCapture={undefined}

备注:内容来源于stack exchange,提问作者Vaibhav Chopade

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 15:59:33