fix: use use effect

This commit is contained in:
TrèsAbhi committed 2024-04-21 10:25:43 -05:00
1 parent 57cd3aae50
commit 0b4829abd3
2 files changed
+18 -24

No files matched your search

+12 -17
View File
@@ -1,19 +1,14 @@
import { useEffect } from 'react';
export function AdHorizontal() {
return (
<>
<div id="ms-ad-635230699" />
<script
dangerouslySetInnerHTML={{
__html: `
window.msAdsQueue.push(() => {
window.pubCenterSdk.render({
adUnitId: "635230699",
elementId: "ms-ad-635230699"
});
});
`,
}}
/>
</>
);
useEffect(() => {
(window as any).msAdsQueue.push(() => {
(window as any).pubCenterSdk.render({
adUnitId: '635230699',
elementId: 'ms-ad-635230699',
});
});
});
return <div id="ms-ad-635230699" />;
}
+6 -7
View File
@@ -1,4 +1,10 @@
import { useEffect } from 'react';
export function Party3() {
useEffect(() => {
(window as any).msAdsQueue = (window as any).msAdsQueue || [];
}, []);
return (
<>
{/* analytics */}
@@ -26,13 +32,6 @@ export function Party3() {
/> */}
{/* pub center */}
<script
dangerouslySetInnerHTML={{
__html: `
window.msAdsQueue = window.msAdsQueue || [];
`,
}}
/>
<script
async
src="https://adsdk.microsoft.com/pubcenter/sdk.js?siteId=364477&publisherId=253617120"