Reactjs 如何在react中包含动画cdn
有人可以告诉我如何在我的react应用程序中包含动画cdn库,我的意思是如何链接它。我尝试在我的根html(index.html)中链接cdn,但是,如何将它与我使用的外部组件文件链接起来?谢谢包括图书馆 包括css和javascript:Reactjs 如何在react中包含动画cdn,reactjs,Reactjs,有人可以告诉我如何在我的react应用程序中包含动画cdn库,我的意思是如何链接它。我尝试在我的根html(index.html)中链接cdn,但是,如何将它与我使用的外部组件文件链接起来?谢谢包括图书馆 包括css和javascript: // ... <head> // ... <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet" />
// ...
<head>
// ...
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet" />
</head>
<body>
// ...
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
</body>
// ...
/。。。
// ...
// ...
// ...
初始化和使用库
函数应用程序(){
useffect(()=>{
window.AOS.init({//初始化
持续时间:2000年
});
});
返回(
//在图书馆做些什么
);
}
你能分享一下你使用的CDN吗?aos(动画库)非常感谢。@KenechukwuNwobodo如果它解决了问题,请接受我的回答。我上面还有一个问题,也许你也可以帮助@Bas Van see Linden
function App() {
useEffect(() => {
window.AOS.init({ // Initialization
duration: 2000
});
});
return (
<div className="App">
// Doing something with the library
<div
style={{
position: "absolute",
width: 500,
height: 500,
backgroundColor: "blue"
}}
data-aos="fade-up">
</div>
</div>
);
}