How Do I Make a Newsletter in ReactJS?

Making a newsletter in ReactJS can be done by using react- Newsletter. This library takes care of creating and sending newsletters, while providing a lot of customizable options.

To get started, first install the library using:

npm install –save react-Newsletter

Next, create a new ReactJS newsletter project using the following command:

react-Newsletter create my-new-project

This will generate a new folder called my-new-project with the following contents:

├── components │ ├── App.jsx │ ├── Newsletter.jsx │ └── style.css ├── index.html ├── README.md ├── src │ ├── App.

jsx │ ├── Newsletter.css ├── vendor └── webpack.config.js.

Now, open up App.jsx and replace the contents with the following:

import React from ‘react’; import { Newsletter } from ‘react-Newsletter’; import ‘./style.css’; export default class App extends React.Component { state = {}; componentDidMount() { this.

_emails = [ new Email(this._name), ]; } render() { return (

My Awesome App

); } }.

Next, open up Newsletter.jsx and replace the contents with the following:

import React from ‘react’; import { Email } from ‘react-Newsletter’; import ‘.css’; export default class Newsletter extends React.Component { constructor(props) { super(props); this._email = props .

email; this._name = props .name; } componentDidMount() { this._emails = [ new Email(this._name), ]; } render() { return (

Hello,

This is my first newsletter!

); } }.

Related Posts