# @aaronhayes/react-use-hubspot-form

> Embed HubSpot forms into your React components using hooks! Works with Create React App, Gatsby and other platforms.

Latest version **2.1.2** (published 2025-07-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @aaronhayes/react-use-hubspot-form
pnpm add @aaronhayes/react-use-hubspot-form
yarn add @aaronhayes/react-use-hubspot-form
bun add @aaronhayes/react-use-hubspot-form
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2025-07-15 |
| First published | 2019-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10.16 |
| Dependencies | 0 |
| Unpacked size | 31.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 52 |
| Maintainers | aaronhayes |
| Keywords | react, hook, hubspot, gatsby, form |

## Links

- npm: https://www.npmjs.com/package/@aaronhayes/react-use-hubspot-form
- Repository: https://github.com/aaronhayes/react-use-hubspot-form
- Homepage: https://github.com/aaronhayes/react-use-hubspot-form#readme
- Issues: https://github.com/aaronhayes/react-use-hubspot-form/issues
- npm.io page: https://npm.io/package/@aaronhayes/react-use-hubspot-form

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.1.2 (latest) — 2025-07-15
- 2.1.1 — 2022-02-05
- 2.1.0 — 2021-09-21
- 2.0.1 — 2021-08-08
- 1.2.6 — 2021-06-24
- 1.2.5 — 2021-04-22
- 1.2.4 — 2021-03-31
- 1.2.3 — 2021-03-31
- 1.2.2 — 2020-11-10
- 1.2.1 — 2020-11-10
- 1.1.0 — 2019-11-23
- 1.0.3 — 2019-11-23
- 1.0.2 — 2019-11-23
- 1.0.1 — 2019-11-23

## README

# React Use HubSpot Form Embed

[![npm (scoped)](https://img.shields.io/npm/v/@aaronhayes/react-use-hubspot-form?style=flat-square)](https://www.npmjs.com/package/@aaronhayes/react-use-hubspot-form)
[![Bundle Size](https://img.shields.io/bundlephobia/min/@aaronhayes/react-use-hubspot-form?style=flat-square)](https://bundlephobia.com/result?p=@aaronhayes/react-use-hubspot-form)
![License](https://img.shields.io/npm/l/@aaronhayes/react-use-hubspot-form?style=flat-square)

Embed HubSpot forms into your React components using hooks! Works with Create React App, Gatsby and other platforms.

## Install

```
$ npm install --save @aaronhayes/react-use-hubspot-form
```

```
$ yarn add @aaronhayes/react-use-hubspot-form
```

## Getting Started

Wrap your application with `HubspotProvider`. This will add [Hubspot script](https://js.hsforms.net/forms/v2.js) to the head of your document.

```TypeScript
import React from 'react';

import { HubspotProvider } from '@aaronhayes/react-use-hubspot-form';

const MyApp = () => (
    <HubspotProvider>
        <MyPage />
    </HubspotProvider>
)

```

## Usage

```TypeScript
import React from 'react';

import { useHubspotForm } from '@aaronhayes/react-use-hubspot-form';

const MyPage = () => {
    const { loaded, error, formCreated } = useHubspotForm({
        portalId: 'XXXXXXX',
        formId: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
        target: '#my-hubspot-form'
    });

    return (
        <div>
            <h1>Embed Form Below</h1>
            <div id="my-hubspot-form"></div>
        </div>
    )
}

```

## Breaking Changes

### 2.0.0

- Introduction of the `HubspotProvider` component. This needs to be included in your App for `useHubspotForm` to work.

---
_Source: https://npm.io/package/@aaronhayes/react-use-hubspot-form · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
