Skip to content
A react hook to embed Mailchimp subscription form.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
lib
src
.babelrc
README.md
index.js
jest.config.js
jest.init.js
package.json
request.js
yarn.lock

README.md

react-use-mailchimp

A react hook to use to create a custom sign up form for your website.

API

import { useMailchimp } from 'react-use-mailchimp';

const url = '...';

const Component = () => {
  const [mailchimp, subscribe, reset] = useMailchimp({
    url
  });
  const { loading, error, data } = mailchimp;

  return (
    <>
      {!!loading ? 'Loading' : null}
      {!!error ? error.message : null}
      {!!data && data.result === 'success'
        ? 'Subscribed!'
        : null}
    </>
  );
};

How to get a url

Check out your Mailchimp account. There you should look for a code to embed into a page. There you can find a url which will look something like:

https://<DOMAIN>.<DATA_CENTER>.list-manage.com/subscribe/post?u=<U>&amp;id=<ID>
You can’t perform that action at this time.