New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-use-mailchimp-signup

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-mailchimp-signup

It provides an easy-to use React Hook to subscribe users to your MailChimp lists

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
37
decreased by-15.91%
Maintainers
1
Weekly downloads
 
Created
Source

Use React MailChimp

It provides an easy-to use React Hook to subscribe users to your MailChimp lists

Install

npm install react-use-mailchimp-signup --save
yarn add react-use-mailchimp-signup

Usage

import React, { useState } from 'react';
// import the hook
import { useMailChimp } from 'react-use-mailchimp-signup';

export const MyComponent = () => {
  const { error, loading, status, subscribe } = useMailChimp({
    action: `https://<YOUR-USER>.us18.list-manage.com/subscribe/post?u=XXXXXX&amp;id=XXXXXX`,
  });

  const [inputs, setInputs] = useState({});

  const handleInputChange = (event) => {
    event.persist();
    setInputs((inputs) => ({
      ...inputs,
      [event.target.name]: event.target.value,
    }));
  };

  const handleSubmit = (event) => {
    if (event) {
      event.preventDefault();
    }
    if (inputs) {
      subscribe(inputs);
    }
  };

  return (
    <>
      {error && <p>{error}</p>}
      {loading && <p>...Loading</p>}
      {status && <p>{status}</p>}

      <form onSubmit={handleSubmit}>
        <label htmlFor="mchimpEmail">Email</label>
        <input
          type="email"
          name="email"
          id="mchimpEmail"
          onChange={handleInputChange}
        />
        <button type="submit">Sign me up!</button>
      </form>
    </>
  );
};

FAQs

Package last updated on 10 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc