【问题标题】:_rete.createEditor is not a function, where is the problem in my code?_rete.createEditor 不是函数,我的代码哪里有问题?
【发布时间】:2020-02-12 15:41:00
【问题描述】:

我尝试在我的代码盒中实现 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 | }

你能找出我的错误吗?

【问题讨论】:

    标签: reactjs codesandbox visual-programming rete


    【解决方案1】:

    查看有关功能组件中 Ref 的反应文档 https://reactjs.org/docs/refs-and-the-dom.html#refs-and-function-components

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-19
      • 2012-08-13
      • 1970-01-01
      • 2021-04-21
      • 1970-01-01
      • 2016-09-18
      • 2021-04-03
      • 1970-01-01
      相关资源
      最近更新 更多