I am not sure to understand how to solve this "most common ScrollTrigger mistake". I have to put all the ScrollTrigger object directly in gsap.timeline as :
foreach {
gsap.timeline({scrollTriger: {
blabla
}.from(element, {blabla})
}
Right?
Anyway, I tried to use the "batch" function :
useEffect(() => {
ScrollTrigger.batch(newsCardRefs.current, {
interval: 1,
onEnter: (batch: Element[]) => gsap.from(batch, { opacity: 0, y: 75 })
});
}, []);
But again, it's not working. I don't know if it is because React ref or something else. I updated the code sandbox accordignly. And I followed this tutorial : https://greensock.com/docs/v3/Plugins/ScrollTrigger/static.batch()