Collect Emails from NextJS Form in HubSpot

Create the Form

First, we create our form component. For this, we will be using plain React and the axios-hooks library to send the content of our form with. In case you haven’t installed it yet, first run:

# For npm
npm install axios axios-hooks

# For Yarn
yarn add axios axios-hooks

Creating our API Endpoint

You might have noticed by now that our EmailSignupComponent tries to send the content of the form to the /api/emailSignup endpoint. Our next step is to create this endpoint and create a truly functional form.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store