npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

renimail-react

v1.0.0

Published

renimail-react is a React component library for adding contacts to a mailing list. It provides an easy-to-use interface for collecting user information and subscribing them to your newsletter.

Downloads

6

Readme

renimail-react

renimail-react is a React component library for adding contacts to a mailing list. It provides an easy-to-use interface for collecting user information and subscribing them to your newsletter.

Installation

To install renimail-react, run the following command in your project directory:

npm install renimail-react

or if you're using yarn:

yarn add renimail-react

Usage

Here's a basic example of how to use the RenimailAddContact component:

import React from 'react';
import RenimailAddContact from 'renimail-react';

const MyComponent = () => {
  return (
    <RenimailAddContact
      url="https://api.reni.ng/reni-mail/v1/createList"
      token="your-api-token"
      listToken="your-list-token"
    />
  );
};

export default MyComponent;

Components

RenimailAddContact

The main component for adding contacts to your mailing list.

Props

  • url (string, required): The API endpoint for subscribing users.
  • token (string, required): Your API authentication token.
  • listToken (string, required): The token for the specific mailing list.
  • render (function, optional): A custom render function for the form. If not provided, it uses the default SimpleForm component.

Example with custom render function

import React from 'react';
import RenimailAddContact from 'renimail-react';

const CustomForm = ({ subscribe, status, message }) => {
  // Your custom form implementation
};

const MyComponent = () => {
  return (
    <RenimailAddContact
      url="https://api.reni.ng/reni-mail/v1/createList"
      token="your-api-token"
      listToken="your-list-token"
      render={({ subscribe, status, message }) => (
        <CustomForm
          subscribe={subscribe}
          status={status}
          message={message}
        />
      )}
    />
  );
};

export default MyComponent;

SimpleForm

A pre-styled form component used as the default render option for RenimailAddContact.

Props

  • status (string): The current status of the form submission ('sending', 'success', or 'error').
  • message (string): A message to display based on the submission status.
  • style (object): Custom styles to apply to the form container.
  • className (string): Custom CSS class for the form container.
  • onSubmitted (function): Callback function to handle form submission.

Styling

The SimpleForm component comes with default styling. You can customize its appearance by passing a style prop or a className prop to the RenimailAddContact component.

API Reference

The component uses Axios to make a POST request to the provided URL. The request includes the following:

  • Headers:
    • Authorization: Basic ${token}
    • Content-Type: 'application/json'
  • Body:
    • mail: User's email address
    • firstname: User's first name
    • lastname: User's last name
    • listToken: The provided list token

Error Handling

The component handles errors and displays appropriate messages based on the API response. If there's an error, it will be displayed in the form.

Tutorial

For more details on how to use the renimail-react component please check out this tutorial

https://medium.com/@enisfiyinfoluwa/how-to-use-renimail-react-for-your-email-subscription-form-6caef7c6536b

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

License

This software is proprietary and closed source. All rights are reserved by FireSwitch Technologies Ltd. Unauthorized copying, modification, or distribution of this software is strictly prohibited.

To obtain permission to use this software, please contact [email protected].