I am trying to insert it directly to my Next.js home page like below:
But when I take the home page, I am seeing an error. It says:
Unhandled Runtime Error Error: Text content does not match server-rendered HTML. See more info here: https://nextjs.org/docs/messages/react-hydration-error
We can take the help of dangerouslySetInnerHTML in this case. We need to replace the
script tag with:
After that we can see the message correctly logged in the console.