how to use wow.js or any other library in react

5.3k Views Asked by At

I need help please I started using react in my first project and I'm facing a problem with installing wow js I searched a lot on the internet but all I found was old methods that don't work now someone help, please

1

There are 1 best solutions below

0
Sanya H On BEST ANSWER

Install the dependency first

npm install wowjs

then import in the required component

import WOW from 'wowjs';

and in a method componentDidMount (for class components) or a hook useEffect (for functional) create an instance and initiate

componentDidMount() {
  new WOW.WOW({
    live: false
  }).init();
}

useEffect(() => {
  new WOW.WOW({
    live: false
  }).init();
}, [])