active-campaign-react
v1.4.0
Published
Library that helps integrating Active Campaign Forms with React
Downloads
74
Maintainers
Readme
Installation
$ npm i --save active-campaign-react
# or
$ yarn add active-campaign-react
Example usage with react-hook-form
import { ActiveCampaignInputs, handleActiveCampaignSubmit } from 'active-campaign-react'
import { useForm } from 'react-hook-form'
export default function ContactForm() {
const { register, handleSubmit } = useForm()
const formId = 'yourFormId'
const onSubmit = async (data) => {
handleActiveCampaignSubmit(data, 'yourComapnySubdomain', formId)
}
return (
<form onSubmit={handleSubmit(onSubmit)}>
<ActiveCampaignInputs formId={formId} />
<input name="name" id="name" {...register('name', { required: true })} />
<input name="email" type="email" id="email" {...register('email', { required: true })} />
<button type="submit">Submit</button>
</form>
)
}