1.0.5 • Published 2 years ago

async-button v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

async-button

Button with asynchronous onClick

NPM JavaScript Style Guide

Install

npm install --save async-button
yarn add async-button

Usage

import React, { Component } from "react";

import { AsyncButton } from "async-button";

export const callback = async (): Promise<void> => {
    return new Promise<void>((resolve) => setTimeout(resolve, 4 * 1000));
};

class Example extends Component {
    render() {
        return (
            <AsyncButton
                // The asynchronous callback.
                onClick={callback}
                // (optional) Whether the onClick should be called automatically.
                callOnMount={true}
                // (optional) Disable the button after onClick has been succesfully called.
                allowOnlyOnce={true}
            />
        );
    }
}
1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago