我尝试在我的codesandbox中实现rete.js可视化编程框架,并在我的canvas.js文件中使用以下代码:
import "../../styles.css";
import { createEditor } from "../../rete";
function Canvas() {
return (
<div className="App">
<div
style={{ width: "100vw", height: "100vh" }}
ref={ref => ref && createEditor(ref)}/>
</div>
);
}
export default Canvas;浏览器显示以下错误消息:
rete.createEditor is not a function
ref
/src/components/layout/Canvas.js:10:40
7 | <div className="App">
8 | <div
9 | style={{ width: "100vw", height: "100vh" }}
> 10 | ref={ref => ref && createEditor(ref)}/>
| ^
11 | </div>
12 | );
13 | }你能在这里找出我的错误吗?
发布于 2020-02-12 23:44:49
查看react文档,了解functional components https://reactjs.org/docs/refs-and-the-dom.html#refs-and-function-components中的Ref
https://stackoverflow.com/questions/60191973
复制相似问题