ReactJS & HubSpot forms & NpmJS

Hello guys.

We have a NextJS & ReactJS application running, and one of my bosses asked me to add the following code inside our app:

<script charset="utf-8" type="text/javascript" src="//js-eu1.hsforms.net/forms/embed/v2.js"></script>
<script>
 hbspt.forms.create({
 region: "eu1",
 portalId: "some-portal-id",
 formId: "some-form-id"
 });
</script>

Now, the problem is, that is HTML code, with a CDN for hbspt.
Is there any plugin on npm, that I can install and use it with import inside a React project?

Thank you, :vulcan_salute:
Emanuel

Hi @einazare, I think, the only option you have is to manually add the code to your React/Next.js application.
You can either add it in the `index.html` file or you can create a custom component for it and add it to your application.

In either case, you will need to make sure that the script is only loaded once and that the script is loaded after the React app has been initialized. This can be done using the `componentDidMount` lifecycle method.