【问题标题】:"TypeError: rootElement.insertBefore is not a function" getting started with React-Handsontable“TypeError: rootElement.insertBefore 不是函数” React-Handsontable 入门
【发布时间】:2018-08-26 21:18:33
【问题描述】:

刚刚开始使用 Handsontable。我使用了create-react-appnpm install --save react-handsontable

App.js添加了一个表格:

import React, { Component } from 'react';
import HotTable from 'handsontable'

class App extends Component {
  render() {
    return (
      <HotTable/>
    );
  }
}

export default App;

看到错误:

TypeError: rootElement.insertBefore is not a function

node_modules/handsontable/dist/handsontable.js:8197

rootElement.insertBefore(this.container, rootElement.firstChild);

从网上搜索看来,这可能与加载顺序问题有关,但我不确定我可以改变什么。

【问题讨论】:

    标签: reactjs handsontable


    【解决方案1】:

    解决方案:我正在导入 handsontable,但我应该导入 react-handsontable

    import HotTable from 'react-handsontable'
    

    这是正确记录的,但我没有注意到那个细节。

    https://github.com/handsontable/react-handsontable

    【讨论】:

      猜你喜欢
      • 2020-08-18
      • 2020-08-25
      • 1970-01-01
      • 2018-05-01
      • 2021-05-01
      • 2017-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多