After posting my comment I think I found the solution.
Instead of using "useGSAP' I'm using a custom hook called "useIsomorphicLayoutEffect".
import { useLayoutEffect, useEffect } from "react";
export const useIsomorphicLayoutEffect =
typeof window !== "undefined" ? useLayoutEffect : useEffect;