【问题标题】:React Wow is not a constructorReact Wow 不是构造函数
【发布时间】:2018-07-13 13:24:15
【问题描述】:

我正在尝试将 Wow.js 添加到我的反应应用程序中。这是我的密码箱的link。我已经导入 wow.js 1.1.2 和 animcate.min.css 3.5.2。在我的 index.js 中,我导入了 animate.min.css

import "./animate.min.css";

在我的 App.js 中,我已经导入并初始化了 wow.js

import WOW from "wowjs";

...
componentDidMount() {
    const wow = new WOW.WOW();
    wow.init();
}

我收到以下错误:

_wowjs2.default.WOW 不是构造函数

感谢您的所有帮助!

【问题讨论】:

  • 哇!你有没有安装 npm wowjs。我认为你应该只分配new Wow() ...
  • @DavidJawHpan 更新代码时出现同样的错误。

标签: javascript reactjs wow.js


【解决方案1】:

试试这个

import WOW from 'wowjs';

componentDidMount() {
    new WOW.WOW({
        live: false
    }).init();
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-19
    • 2017-01-16
    • 2018-04-27
    • 1970-01-01
    • 1970-01-01
    • 2021-12-31
    • 2019-12-09
    • 2021-10-26
    相关资源
    最近更新 更多