very new to NextJS and I’m running into a problem with a third-party ebay script I’m trying to display on one of my routes page. It only seems to display sometimes when I reload. When the page is changed to the store page through a link/route, it does not display anything.
Any idea what I could be doing wrong or other method that I can use to fix this? Thank you!
import Script from "next/script";
import Image from "next/image";
const page = () => {
return (
<>
<section className="max-container padding-container flex flex-col gap-20 py-10 md:gap-28 lg:py-20 xl:flex-row">
{/*rest of code here*/}
</section>
<div className="2xl:max-container relative flex flex-col lg:mb-10 lg:py-10 bg-white">
<Script
type="text/javascript"
src="https://www.auctionnudge.app/feed/item/js/theme/responsive/page/init/img_size/120/cats_output/dropdown/search_
box/1/blank/1/show_logo/1/lang/english/SellerID/example/siteid/0/MaxEntries/35/sortOrder/StartTimeNewest/target/52d212f5f"
/>
<div id="auction-nudge-52d212f5f" />
</div>
</>
);
};
export default page;
I’ve seen other users ask and I tried using the strategy=”beforeInteractive” and other methods such as useEffect, but had no luck. I need the script to only load on this specific page so I don’t think I can put it in layout.tsx.
Leo Babakhanian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.