Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Integration with React.js #57

Open
dnzk opened this issue Aug 23, 2017 · 2 comments
Open

Integration with React.js #57

dnzk opened this issue Aug 23, 2017 · 2 comments

Comments

@dnzk
Copy link

dnzk commented Aug 23, 2017

Hi, thanks for the awesome library. I need help though with the library's integration with React. Seems like the events are not propagating as well as expected in React. enter fires as soon as the component mounted and leave never fires. Is there a way to make this work with React? Cheers!

@silvestreh
Copy link
Owner

The plugin fires the events when scrolling, that's probably why. I never tried to tie this up with React, but sounds like you should probably use lifecycle hooks if you want to do stuff when mounting / unmounting components.

@dnzk
Copy link
Author

dnzk commented Aug 24, 2017

I've tried putting them in lifecycle hooks, no luck. The events fire every time after I resize the viewport window right after the event supposed to happen. So let's say for enter, after the target element enters the viewport, the callback wouldn't be executed until I resize the window while the element is still in viewport. Probably it's in how React treats (or rather, not treating) changes that happen outside of its virtual DOM. If that assumption is true however, I'm not sure of how to force it to be aware of the changes made by the library.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants