Nextjs Forms Setup - No luck

Status: Idea Submitted

Hi there, I have been trying to add a footer subscription form from Hubspot in my Nextjs App.
After trying some ways, and checking the documentation around this( not much to be honest) seems that the best way is this:

<Script id="hs-legacy-forms-js" src="//js.hsforms.net/forms/v2-legacy.js" strategy="beforeInteractive" />
 <Script id="hs-forms-js" src="//js.hsforms.net/forms/v2.js" strategy="beforeInteractive" onLoad={() =>hbspt.forms.create({})}/> 
 <Script id="hbspt-footer" strategy="afterInteractive" dangerouslySetInnerHTML={{ __html: `
 hbspt.forms.create({
 region: "na1",
 portalId: "20#####",
 formId: "5190425c-61e6-4ff3-bc6e-1d12786f903d",
 target: '#footer_form'
 });
 `}} />
 <div id="footer_form" className={styles.footer_form}></div>

Seem that it work, but at the second time that I refresh the page, I mean, the form not appears the first time that page loads.
Is there any approach that I might be missing? This is a pain. Thanks!

Dear Kennethbrenes,

did you manage to fix the issue yourselve and already implemented it properly? I would be very interested in your solution.

Thanks in advance and all the best

Philipp