react-scrollmagic icon indicating copy to clipboard operation
react-scrollmagic copied to clipboard

How to change component state on Scene event?

Open blazenko opened this issue 3 years ago • 1 comments

Hi

is it possible to assign an event listener to a Scene?

Access to events is described here https://github.com/bitworking/react-scrollmagic/issues/2 and here https://github.com/bitworking/react-scrollmagic/issues/34 by wrapping Scene's child in a function. This does "give access" to events, but I need to change component state on event, and for that I need to assign a listener, not call a handler directly; because since the wrapper function is inside render(), I can't call state change from there (a React no-no).

How can I accomplish component state change on, say, enter or leave event?

blazenko avatar Aug 20 '21 21:08 blazenko

solved?

andychoww avatar Jan 11 '22 07:01 andychoww