6

when I try to require WOW by one of those statements

global.WOW = require('wowjs');
var WOW = require('wowjs');
window.WOW = require('wowjs');

I receive this error

jQuery.Deferred exception: WOW is not a constructor TypeError: WOW is not a constructor

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624
Ali Turki
  • 1,265
  • 2
  • 16
  • 21

3 Answers3

13

try this one

const WOW = require('wowjs');

window.wow = new WOW.WOW({
    live: false
});

window.wow.init();
Ashraf Farhan
  • 456
  • 5
  • 9
3

the module exports an object, you need to use the WOW constructor in that object. Eg. require('wowjs').WOW

Gabo Esquivel
  • 3,494
  • 2
  • 23
  • 18
0

You need to use wow.js instead of wowjs in React

npm install wow.js

and in your code

import WOW from 'wow.js'

useEffect(() => {
    const wow = new WOW({ live: false }) // disables sync requirement
    wow.init()
}, [])