React (CRA/Vite, CSR)
<!-- public/index.html -->
<script
async
src="<https://glyph-core.s3.us-east-1.amazonaws.com/test/Glyph-unified-bundle.js>"
></script>
// App.tsx
import { useEffect } from "react";
export default function App() {
useEffect(() => {
let mounted = true;
(async () => {
if (!mounted) return;
await window.Glyph?.initWidget({
theme: {
primaryColor: "#007bff",
placement: "bottom-right",
theme: "light",
},
supportedChains: ["base"],
});
})();
return () => {
mounted = false;
// Optional cleanup:
window.Glyph?.destroyReactIframe?.();
};
}, []);
return <div>My App</div>;
}Last updated