Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-async-button

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-async-button

React button component for handling async actions

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
329
decreased by-66.63%
Maintainers
1
Weekly downloads
 
Created
Source

react-async-button

React button component for handling async actions. Inspired from ember-async-button

npm version Build Status Coverage Status

Installation

$ npm install react-async-button --save

DOCS & DEMO

https://selvagsz.github.io/react-async-button/

Example


import React from 'react';
import { render } from 'react-dom';
import AsyncButton from 'react-async-button';

export default App extends Component {
  clickHandler() {
    return new Promise((resolve, reject) => {
      // some async stuff
      setTimeout(resolve, 500);
    })
  }

  render() {
    return (
      <AsyncButton
        className="btn"
        text="Save"
        pendingText="Saving..."
        fulFilledText="Saved Successfully!"
        rejectedText="Failed! Try Again"
        loadingClass="isSaving"
        fulFilledClass="btn-primary"
        rejectedClass="btn-danger"
        onClick={this.clickHandler}
       />
    )
  }
}

render(<App/>, document.getElementById('root'));

Note clickHandler should return a promise for the pending state

Keywords

FAQs

Package last updated on 31 Jul 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc