Hello GSAP gang, I have a little bit of a situation going on.
I understand that there's already a post on this topic, but I need help with this one as well.
I've got some code that I have tried out but it seems that I've been unable to fix this issue. The coding sandbox comes up with an error: "Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node." https://codesandbox.io/s/react-router-re-render-8btmz?file=/src/index.js
I was wondering if
Hi @Tonycre8
GSAP needs to do some cleanup before the component gets removed from the DOM, so you should create your scroll triggers inside useLayoutEffect like this. There should be no need to add an extra div using this method.
useLayoutEffect(() => {
let st = ScrollTrigger.create({
pin: true,
...
});
return () => {
st.kill();
};
}, []);