Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何在react中包含动画cdn_Reactjs - Fatal编程技术网

Reactjs 如何在react中包含动画cdn

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" />

有人可以告诉我如何在我的react应用程序中包含动画cdn库,我的意思是如何链接它。我尝试在我的根html(index.html)中链接cdn,但是,如何将它与我使用的外部组件文件链接起来?谢谢

包括图书馆 包括css和javascript:

// ...
<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>
  );
}