我正在做一个React + TypeScript项目,其中我引入了提供的"How can I measure a DOM node?“示例,但我似乎无法让React的类型来确认有人会将useCallback的返回值作为ref传递的情况。我在this CodeSandbox中重新创建了它的基本用法。如果您打开它,您应该会看到此行上的TypeScript错误指示器: <div ref={ref} clas
我尝试将字符串作为ref,但在尝试使用ref?.current时收到警告 Property 'current' does not exist on type 'string' 界面中的ref prop应该使用什么。我不知道裁判的类型会是什么。interface IProps { time: number}