@shhhplus/react-timer
v2.0.3
Published
This react timer component is very simple!
Downloads
3
Maintainers
Readme
react-timer
This react timer component is very simple!
Install
npm install @shhhplus/react-timer --save
How to use
sync
import Timer from '@shhhplus/react-timer';
const Demo = () => {
const onElapsed = () => {
console.log('...');
};
return <Timer interval={1000} onElapsed={onElapsed} />;
};
async
import Timer from '@shhhplus/react-timer';
const Demo = () => {
const onElapsed = () => {
console.log('...');
return new Promise((resolve) => {
setTimeout(resolve, 100);
});
};
return <Timer interval={1000} onElapsed={onElapsed} />;
};