mirez / react-use-hubspot-form

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Use HubSpot Form Embed

npm (scoped) Bundle Size License

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

Usage

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>
    )
}

About

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

License:MIT License


Languages

Language:TypeScript 93.9%Language:JavaScript 6.1%