reactjs - 使用引用 "refers to a value, but is being used as a type here."

标签 reactjs typescript react-hooks

我想弄清楚如何告诉 React 哪个元素被用作 ref,即在我的例子中

const circleRef = useRef<AnimatedCircle>(undefined);

AnimatedCircle是第三方库中的SVG组件,这样定义会出错

enter image description here

是否有一些通用的方法来定义哪个元素是 ref?

最佳答案

在我的例子中,我将文件重命名为 .ts 而不是 .tsx。再次重命名修复了它。

关于reactjs - 使用引用 "refers to a value, but is being used as a type here.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55576953/

相关文章:

reactjs - 在reactJS中,如何通过按下按钮来调用链接单击?

javascript - setState 不设置值

javascript - 获取触摸事件路径中的元素

javascript - 动态表单为第一个和第二个输入返回相同的值

javascript - 升级到 NextJS 9.0 后如何修复 React Hooks?

reactjs - react Hook : how to access props within "mount" useEffect & not throw linting warning

reactjs - 如何在 React JS 的文本中使单词可点击

node.js - TypeScript 中的 express-ws 替代方案

javascript - 尽管我的组件已在我的模块的 entryComponents 选项中声明,但 Angular 如何找不到该组件的组件工厂?

javascript - 导出 `index.ts` 中的所有文件