gsap.to works fine, my issue with gsap.from
If I call gsap.from using a button, it works fine but if it is inside useEffect then it will not work
this code below not working:
useEffect(() => {
gsap.from(".h1", { x: -2500,duration:1 });
});
this one works fine:
function App() {
const clicked = () => {
gsap.from(".h1", { x: -2500,duration:1 });
};
useEffect(() => {
});
return (
<div className="App">
<h1 className="h1">Hello</h1>
<h1 className="x500">X=500</h1>
<button className="btn" onClick={() => clicked()}>
click me
</button>
</div>
);
}