我正在尝试将Locomotive Scroll与 React 17 一起使用。我不知道如何正确设置组件以使其正常工作。我找到的所有示例都是针对旧版本的 React,我不明白。
有谁知道如何让它工作?
我想它应该看起来像这样:
import React from "react"
import LocomotiveScroll from "locomotive-scroll"
const ComponentName = () => {
//some code here
return (
<div data-scroll-container>
<section data-scroll-section>
<h1 data-scroll>Hey, there!</h1>
<p
role="img"
aria-label=""
data-scroll
data-scroll-direction="horizontal"
data-scroll-speed="3"
>
</p>
</section>
<section data-scroll-section>
<h2 data-scroll data-scroll-speed="1">
What's up?
</h2>
<p data-scroll role="img" aria-label="">
</p>
</section>
</div>
);
}
export default ComponentName