1const el = useRef();
2const q = gsap.utils.selector(el);
3
4useEffect(() => {
5 // Target ALL descendants with the class of .box
6 gsap.to(q(".box"), { x: 100 });
7}, []);
1function App() {
2 // store a reference to the box div
3 const boxRef = useRef();
4
5 // wait until DOM has been rendered
6 useEffect(() => {
7 gsap.to(boxRef.current, { rotation: "+=360" });
8 });
9
10 // DOM to render
11 return <div className="box" ref={boxRef}>Hello</div>;
12}