Is there a way to use Wavify with React?

Viewed 495

I have been using a JavaScript library called Wavify(https://github.com/peacepostman/wavify) to create wave animations in my websites.

I recently started Learning React and wondered if I could use Wavify in my react projects by installing it with npm.

I have tried:

import React from 'react';
import {TweenMax} from 'gsap';
import {wavify} from 'wavify';
import './App.css';


function App() {

  let wave = React.createRef();

   let waveAnimation = wavify(wave, {
    height: 60,
    bones: 3,
    amplitude: 40,
    color: 'rgba(150, 97, 255, .8)',
    speed: .25
  })

  return (
    <div className="App">
      <div id="wave" ref={wave}></div>
    </div>
  );
}

export default App;

but I keep getting the error:

TypeError: Object(...) is not a function
App
C:/Users/*****/*****/myReactApp/src/App.js:14
  11 | 
  12 | let wave = React.createRef();
  13 | 
> 14 |  let waveAnimation = wavify(wave, {
     | ^  15 |   height: 60,
  16 |   bones: 3,
  17 |   amplitude: 40,
View compiled
▶ 16 stack frames were collapsed.

any suggestions would be greatly appreciated.

1 Answers
Related