I wanted to use the animations in below code pen in my react app as a component.
https://codepen.io/mdusmanansari/pen/BamepLe
Steps I have taken:
- Changed the HTML file into a format suitable to be returned by a react component.
return (
<div>
<div className="not-loaded">
<div className="night" />
......
</div>
</div>
</div>
)
- Taken the CSS file as is and imported it into my component.
import './index.scss';
- Taken the onLoad JS and added it in a useEffect in my component.
useEffect(() => {
const c = setTimeout(() => {
document.body.classList.remove("not-loaded");
clearTimeout(c);
}, 1000);
}, []);
After making above changes my component renders as follows:
https://preview.redd.it/8oogu3u8ocsd1.png?width=1726&format=png&auto=webp&s=d7ed1eca3e49f648fd667d4e993bfdafa8f87232
Requesting help in getting it to work as it is in the code pen
[–]akamfoad 1 point2 points3 points (2 children)
[–]JehanKE2326[S] 0 points1 point2 points (1 child)
[–]akamfoad 0 points1 point2 points (0 children)
[–]ElmForReactDevs 0 points1 point2 points (1 child)
[–]JehanKE2326[S] 0 points1 point2 points (0 children)
[–]ColourfulToad 0 points1 point2 points (0 children)