首页 > 解决方案 > cubiq - IScroll.js | 我应该在哪个方法生命周期中将自定义事件放入 React JS

问题描述

cubiq - IScroll.js

你好,请问一下。我正在开发的 React JS 项目中使用 IScroll.js 库。在库中有一个自定义事件来处理滚轮项目。你可以在这里看到更多:https ://github.com/cubiq/iscroll#onscroll 。

一个例子是滚动/滚动结束。

myScroll = new IScroll('#wrapper', { probeType: 3, mouseWheel: true });

myScroll.on('scroll', updatePosition);
myScroll.on('scrollEnd', updatePosition);

我的问题是在这个 React JS 项目中,我应该将自定义事件放在哪个生命周期方法中。谢谢你。

标签: javascriptreactjsecmascript-6iscrollreact-lifecycle

解决方案


推荐阅读