1.0.0 • Published 2 years ago

@strapi-newsletter/react v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Strapi Newsletter React ⚛️

Introduction 📖

Strapi Newsletter React is a ReactJS component and a utility function that will allow a user in your website to subscribe to a newsletter. You have access to a React JS component called <Newsletter /> that will allow you to display a newsletter subscription form and a helper function called subscribeUser if you want to handle the subscription UI yourself.

Installation ⏳

Run any of the following commands inside your strapi directory to install the package:

npm i @strapi-newsletter/react

yarn add @strapi-newsletter/react

Usage 💄

  1. React Component ⚛️
import Newsletter from "@strapi-newsletter/react";

const App = () => (
  <Newsletter strapiEndpoint="http://localhost:1337" buttonText="Subscribe" />
);
  1. Helper Function
import { subscribeUser } from "@strapi-newsletter/react";

const handleUserSubscribe = async (email) => {
  await subscribeUser(email, "http://localhost:1337");
};