-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathSubscribeButton.jsx
More file actions
42 lines (36 loc) · 1.23 KB
/
SubscribeButton.jsx
File metadata and controls
42 lines (36 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React, { useEffect, useRef } from 'react';
const SubscribeButton = () => {
const formRef = useRef(null);
useEffect(() => {
const script = document.createElement('script');
script.src = '//js.hsforms.net/forms/embed/v2.js';
script.charset = 'utf-8';
script.type = 'text/javascript';
script.async = true;
document.body.appendChild(script);
script.addEventListener('load', () => {
if (window.hbspt && window.hbspt.forms) {
window.hbspt.forms.create({
region: "na1",
portalId: "23341221",
formId: "87576ba1-bb40-433e-9257-4af82e747a6e",
target: "#hubspot-form-wrapper",
});
}
});
return () => {
document.body.removeChild(script);
};
}, []);
return (
<div className="footer_greenbox">
<div className="flex_item">
<h4 className="green_text">
Stay up to date with product updates & news
</h4>
</div>
<div className="flex_item" id="hubspot-form-wrapper" />
</div>
);
};
export default SubscribeButton;