An open API service indexing awesome lists of open source software.

https://github.com/revolunet/react-mailchimp-subscribe

React subscribe form for Mailchimp.
https://github.com/revolunet/react-mailchimp-subscribe

mailchimp reactjs subscribe

Last synced: about 1 year ago
JSON representation

React subscribe form for Mailchimp.

Awesome Lists containing this project

README

          

# react-mailchimp-subscribe

[![npm package][npm-badge]][npm]

React subscribe form for Mailchimp.

Working demo : https://revolunet.github.io/react-mailchimp-subscribe/

## Usage

Create a list on mailchimp, add an "Embedded" form and get its "action" attribute from the mailchimp UI

The `MailchimpSubscribe` gives you a render prop with a `subscribe` method that you can call with your data.

In your app :

```jsx
import MailchimpSubscribe from "react-mailchimp-subscribe"

const url = "//xxxx.us13.list-manage.com/subscribe/post?u=zefzefzef&id=fnfgn";

// simplest form (only email)
const SimpleForm = () =>

// use the render prop and your custom form
const CustomForm = () => (
(


subscribe(formData)} />
{status === "sending" &&
sending...
}
{status === "error" &&
}
{status === "success" &&
Subscribed !
}

)}
/>
)
```

see examples in [./demo/src](./demo/src)

[npm-badge]: https://img.shields.io/npm/v/react-mailchimp-subscribe.png?style=flat-square
[npm]: https://www.npmjs.org/package/react-mailchimp-subscribe