How to use the react-countdown.useCountdown function in react-countdown

To help you get started, we’ve selected a few react-countdown examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ndresx / react-countdown / examples / src / CountdownHook.tsx View on Github external
const CountdownHook: React.FC = () => {
  const props = useRef({ date: Date.now() + 5000 });
  const { hours, minutes, seconds, api } = useCountdown(props.current);
  return <span>{api.isCompleted() ? 'Completionist!' : `${hours}:${minutes}:${seconds}`}</span>;
};

react-countdown

A customizable countdown component for React.

MIT
Latest version published 1 year ago

Package Health Score

62 / 100
Full package analysis

Popular react-countdown functions