import React from "https://esm.sh/react@19.0.0";
import ReactDOM from "https://esm.sh/react-dom@19.0.0/client";
import gsap from "https://esm.sh/gsap";
import { useGSAP } from "https://esm.sh/@gsap/react?deps=react@19.0.0";
gsap.registerPlugin(useGSAP)
function App() {
const { contextSafe } = useGSAP();
// ✅ wrapped in contextSafe() - animation will be cleaned up correctly
const onEnter = contextSafe(({ currentTarget }) => {
gsap.to(currentTarget, { rotation: "+=360" });
});
return (
<div className="app flex-row">
<div className="box gradient-blue" onClick={onEnter}>
Click Me
</div>
</div>
);
}
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<App />);
View Compiled