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

react-comment-form

v0.1.9

Published

A component to render a comment form and Like widget for your website or blog

Downloads

23

Readme

Getting Started with Create React App

This project was bootstrapped with Create React App. Publishing to package manager was done using instructions here

To install this component

npm install react-comment-form

To use this component

Prerequisites: You need to have Node + NPM installed.

import React from "react";
import QuotesSlider from "react-comment-form";

export default function MyBlogCommentForm() {
  return (
    <CommentForm
      parentId="unique_id"
    />
  );
}

parentId is a mandatory property. It identifies all comments that belong to the same parent (e.g.: a blog post).

Backend APIs

This component expects the following backend APIs. The public repo here has example code written as Azure Functions, but any API that follows the protocol below would do.

  1. REACT_APP_BLOGMETADATA_URL. This environment variable should point to an API supporting POST, GET that accepts the following parameters and returns another json response.
Input to API

    {
        "name": "parentId"
    }


Output/Response from API
   {
        "name": "parentId",
        "comments": "all_stored_comments",
        "likes":"current_like_count"
    }

  1. REACT_APP_UPDATELIKES_URL. This environment variable should point to an API supporting POST, GET that will update the current like count, addint the passed in numeric value to the existing count. It will return the final updated count in respose.
Input to API

    {
        "name": "parentId",
        "likes": number_to_add_current_like_count
    }


Output/Response from API is expected to be an int value 
  1. REACT_APP_COMMENTS_URL. This environment variable should point to an API supporting POST, GET that will update the current comments by prepending the existing comments with the string passed in.
Input to API

    {
        "name": "parentId",
        "comments": "comments to prepend."
    }


Output/Response from API is expected to be an string value that will contain all the comments 
including what is passed in. 
  1. REACT_APP_SENDMAIL_URL. This environment variable should point to an API supporting POST, GET that will send email using a service like SendGrid. This API is only needed if REACT_APP_SENDMAIL is set to true - see below.
Input to API

    {
        "fromemail": "fromemail_from_form",
        "from": "user name from form",
        "message": "comment"
    }


Output/Response from API is expected to be an string value that will contain all the comments 
including what is passed in. 

Environment variables

The following environment variables are expected by the component. You can set them in a .env file at the root of your project

REACT_APP_SENDMAIL_URL (Backend API to send email if REACT_APP_SENDMAIL is true)
REACT_APP_SENDMAIL (true|false. If true, every new comment will be sent as an email using the backend API above)
REACT_APP_SENDMAIL_API_KEY (the component will send email if REACT_APP_SENDMAIL is set to true and sendmail is configured)
REACT_APP_BLOGMETADATA_URL (backend API to retrieve info from storage of blog metadata - comments, likes)
REACT_APP_UPDATELIKES_URL (backend API to update like count )
REACT_APP_GOOGLE_CAPTCHA_SITE_KEY (your key for captcha. see [here](https://www.google.com/recaptcha/admin/create))
REACT_APP_COMMENTS_URL (backend API to add comments)
REACT_APP_API_KEY (API key for communicating with the backend API. This will be appended to the end of the 
URLs above with a query string ?code=REACT_APP_API_KEY