如何在React中使用jQuery.stellar

时间:2016-09-09 11:30:20

标签: jquery reactjs stellar.js

如何配置我的React项目以便能够使用以下代码:

$(window).stellar()

我正在使用Webpack和ProviderPlugin,设计已准备就绪 - 只剩下安装和附加Stellar库

1 个答案:

答案 0 :(得分:0)

要在反应中使用jquery,这里是示例代码:

import $ from 'jquery';

... // here goes class definition and constructor 

componentDidMount() {
  $(window).stellar()
}

componentWillUnmount() {
  $(window).stellar("destroy");
}

我希望这会有所帮助。