Why does next/script not work for google recaptcha?

Viewed 725

I am currently in the process of migrating from next js version 8 to 11. I want to use this amazing next js feature for next/script. But when I use it for the google recaptcha the captcha doesn't load for "react-recaptcha": "^2.3.10". I had to roll back to using the following code:-

 <script
    rel="dns-prefetch"
    defer
    async
    importance="low"
    type="text/javascript"
    src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit"
  />

But when I used next/script as follows the captcha did not load:-

<Script
    strategy="beforeInteractive"
    src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit"
  ></Script>

I am also using Moengage and razor pay in my project I haven't checked it for razor pay but Moengage doesn't work with next/script.

Any help or suggestion is appreciated thanks for your time.

1 Answers
Related