@shhhplus/react-timeout
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

react-timeout

GitHub license npm version codecov build status

This react timeout component is very simple!

Install

npm install @shhhplus/react-timeout --save

How to use

sync

import Timeout from '@shhhplus/react-timeout';

const Demo = () => {
  const onElapsed = () => {
    console.log('...');
  };
  return <Timeout delay={1000} onElapsed={onElapsed} />;
};

async

import Timeout from '@shhhplus/react-timeout';

const Demo = () => {
  const onElapsed = () => {
    console.log('...');
    return new Promise((resolve) => {
      setTimeout(resolve, 100);
    });
  };
  return <Timeout delay={1000} onElapsed={onElapsed} />;
};

Package Sidebar

Install

npm i @shhhplus/react-timeout

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

3.38 kB

Total Files

5

Last publish

Collaborators

  • shhhplus