Today, I decided to improve my website by adding scroll reveal to it. For that, I chose jlmakes' ScrollReveal.js which solved my problem in a snap, the biggest problem was integrating it with React (Turns out, it was also a piece of cake).
The code
ScrollReveal.js provides a constructor ScrollReveal()
that returns its instance. The method reveal()
is responsible for registering the target element with ScrollReveal
, it has a target
argument (which can be a CSS Selector, a DOM Node, or an Array of Nodes) and an options
argument which allows customizing the reveal behavior. That being said, we can use useRef
hook to connect the React Node to ScrollReveal:
Top comments (5)
Hola, como seria con module.css?
The components are drawn for a split second, and only then the animation starts to work. How to get rid of this?
Can you send me an example?
I used your code in codeandbox.
Oh thanks! This will definitely come in handy
Some comments may only be visible to logged-in visitors. Sign in to view all comments.