import React from "https://esm.sh/react";
import ReactDOM from "https://esm.sh/react-dom";
import gsap from "https://esm.sh/gsap";
import { useGSAP } from "https://esm.sh/@gsap/react";
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