0.0.2 ā€¢ Published 3 years ago

react-submitter v0.0.2

Weekly downloads
-
License
GPL-3.0
Repository
-
Last release
3 years ago

React Submitter šŸ”„

A friendly interactive Submitter for āš›ļø React.

Demo

Edit wonderful-banzai-1mz41

Features

āœ… TS Support

āœ… Zero dependencies

āœ… No CSS import

āœ… No Assets import : Spinner, Cancel & Retry icons are embedded in the component

āœ… Demo mode : Instant hands-on

āœ… Customization : Infinite number of loading steps, custom texts, colors & duration

āœ… Ability to cancel triggered request

Use it with caution āš ļø:

Long texts will result in poor user experience.

Installation

With npm :

npm install react-submitter

With yarn :

yarn add react-submitter

Instant hands-on

function App() {

  return (
    <>
      <Submitter /> {/* will resolve (default).*/}
      {/* Or <Submitter demo={'reject'} /> will reject.  */}

    </>
  );
}

Standard usage

function App() {

  const handleSuccess = (data: any) => {
    // Do something with successful response
  }

  const handleFailure = (message: any) => {
    // Do something in case of failure
  }

  return (
    <div className="App">
      <Spinnter trigger={() => /* your fetcher goes here e.g fetch(url) */)} onSuccess={handleSuccess} onFailure={handleFailure} />
    </div>
  );
}

Asking Questions

If you have a question, feel free to contact me on this email ali.rafiq.it@gmail.com.

License

This project is licensed under the GPL-3.0 License. See the LICENSE file for more info.