score:1

Accepted answer

According to the docs react-visibility-sensor :

You can pass a child function, which can be convenient if you don't need to store the visibility anywhere

so maybe instead of using the onchange function you can just pass the isVisible parameter, something like:

<VisibilitySensor>
  {({isVisible}) =>
     <Anime delay={(e, i) => i * 100}
         // the rest of your codes here ...
     </Anime>
  }
</VisibilitySensor>

Otherwise you can convert this function to a react component and set states, etc..


Related Query

More Query from same tag