useEffect:
Copy
Ask AI
import { useEffect } from "react";
export default function Pricing() {
useEffect(() => {
const script = document.createElement("script");
script.src = "https://cuprice.io/embed.js";
script.async = true;
document.body.appendChild(script);
return () => {
document.body.removeChild(script);
};
}, []);
return <div data-cuprice-id="YOUR_SHARE_ID" />;
}
Make sure the cleanup function removes the script on unmount to avoid duplicates if the component re-mounts.
