@shhhplus/react-timeout
v1.0.1
Published
This react timeout component is very simple!
Downloads
3
Maintainers
Readme
react-timeout
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} />;
};