alexkhismatulin / react-use-count-down Goto Github PK
View Code? Open in Web Editor NEWDead simple yet powerful countdown hook for React.
Home Page: https://stackblitz.com/edit/react-use-count-down
License: MIT License
Dead simple yet powerful countdown hook for React.
Home Page: https://stackblitz.com/edit/react-use-count-down
License: MIT License
Hello,
I'm using nextjs@^13.5.4 and react-countdown-hook@^1.1.3
Some warnings printed in terminal when i try to build my app:
Collecting page data ..(node:121361) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:121371) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
Collecting page data ...(node:121568) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:121538) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:121411) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:121588) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:121578) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:121421) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:121481) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:121401) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:121461) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:121508) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
โ Collecting page data
Generating static pages (0/56) [ ](node:121451) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
Generating static pages (2/56) [= ]
(node:121381) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:121431) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:121492) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:121471) [DEP0128] DeprecationWarning: Invalid 'main' field in '/SOME_DIRECTORIES/frontend/node_modules/react-countdown-hook/package.json' of 'dist/index.js'. Please either fix that or report it to the module author
Can you help to resolve warnings?
how to find that timer is completed. I havent found any way.Please suggest How can i get that countdown is completed
It could be great to have tome insight on the countdown, ot be aware if it's running, paused, completed/finished.
If you leave the page in another tab, browse in another tab, wait some time then come back to the tab with the Countdown, notice the countdown tried to countdown fast to fill in the missing time when you were away in another tab.
It happens with the demo also: https://stackblitz.com/edit/react-use-count-down?file=index.js
Could we cancel the animation frame when users navigate away from the current tab?
Hi)
Thank you for a nice and clean lib.
I have a question/proposal for you. How is it supposed to be used to run some logic at the end of the timer? For example I need to trigger log out when timeLeft === 0
, but it's a default value. Maybe it's better if timeLeft
would be not equal zero by default on start/restart but to equal initialTime
? Or maybe you're working on some kind of onExpire
callback?
const [timeLeft, setTimeLeft] = React.useState(0);
Here,initial state should not be '0',use the argus 'timeToCount' is more better.
cause ,'0' is the mark of the beginning and the end,Can cause initialization rendering problems
Great hook and clean. Could we return some indicators that state when the counter is running or is paused?
When I closed the MacBook lid and put the computer into sleep, the timing was inaccurate (verified with an iPhone stopwatch).
Hi thanks for the lib. It would be useful to start the countdown immediately without manually calling start
Currently none available
$ yarn add @types/react-countdown-hook
yarn add v1.22.10
[1/4] ๐ Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@types%2freact-countdown-hook: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/Users/cypressf/repos/aniguesser/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Right now I in my cleanup I just pause the timer. I was wondering if this was enough or there was a cleanup function I could when my component unmounts.
If the countdown starts on a tab and you switch to another in the browser, it stops counting.
This behaviour is seen on chrome.
I tried it also in edge, it also stops counting there but accelerates when the tab is active to reach the count where it should be.
Hi.
Do you have plans for supporting react 18 and update the peerDependency?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.