New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

react-simple-user-feedback

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-simple-user-feedback

A React library for simple user feedback components

latest
Source
npmnpm
Version
0.1.3
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

React Simple User Feedback

The library that makes gathering user feedback simple

NPM Version MIT License

Resources

  • Github
  • Full Documentation and Examples
  • NPM Page

Installation

To add to your React app,

npm install react-simple-user-feedback

or with Yarn,

yarn add react-simple-user-feedback

Usage

See the following example live here

import React, { Component } from 'react';
import { BinaryFeedback } from 'react-simple-user-feedback';

class Example extends Component {
    constructor(props){
        this.state = {
            positiveCount: 0,
            negativeCount: 0
        }
    }

    onPositiveClick = () => {
        this.setState(prevState => {
            return { positiveCount: prevState.positiveCount + 1 }
        });
    }

    onNegativeClick = () => {
        this.setState(prevState => {
            return { negativeCount: prevState.negativeCount + 1 }
        });
    }

    render(){
        return (
            <div>
                <BinaryFeedback
                    onPositiveClick={this.onPositiveClick}
                    onNegativeClick={this.onNegativeClick}
                />
            </div>
        );
    }
}

API

Binary Feedback

The Binary Feedback component is used to gather feedback in which there are two options. Default look is the "thumbs up" and "thumbs down" format.

This component takes the following props:

NameTypeDefaultDescription
onPositiveClickFunctionRequiredCallback function called when positive button is clicked
onNegativeClickFunctionRequiredCallback function called when negative button is clicked
singleSelectBooleanfalseWhen the user selects a response, disable the other button to disable potentially multiple responses.
positiveContentString, JSXThumbs Up SVGContent that goes on the positive button
negativeContentString, JSXThumbs Down SVGContent that goes on the negative button
positivebooleanfalseSet the selected state to positive
negativebooleanfalseSet the selected state to negative

Contributors

Built from react-library-starter. Check it out for an easy way to turn a React component into a NPM package!

Authors:
  • Teddy Ni

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

react

FAQs

Package last updated on 27 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts