Hello,
First of all, I want to say that GSAP has been a fantastic product that has solved many problems for me. I really enjoy using it for my projects!
Lately, I started to use scrollTrigger with React and I noticed a strange behaviour.
In my minimal codesandbox example, I designed it so that the scrollTrigger is only allow to slide the "door" div to the right during onEnter on the first time only. I am using React state in "iterCount" to prevent the door div from triggering any subsequent time.
However, when I console.log the iterCount state, it appears that the scrollTrigger never received the updated iterCount after it was incremented by the onComplete event. Meanwhile, the iteration count is correctly incrementing in the React App itself in the counter at the top of the page. What is missing here?
https://codesandbox.a/s/gsap-updating-state-hooks-sliding-door-xucoo0