All notable changes to this project are documented here. This project adheres to Semantic Versioning.
A full rewrite of the internals: all countdown logic now lives in a framework-agnostic engine, and React is a thin adapter on top of it. The component is built on a new public useCountdown hook, so both surfaces share one lifecycle. Changes below are relative to 2.3.6.
- Requires React 18+ (was React 16/17). The adapter uses
useSyncExternalStore. - Imperative ref accessor changed.
<Countdown />is now a function component; reach the control API viaref.current.api. The v2ref.current.getApi()accessor is removed (the.apipath is unchanged). - Removed the
classNameprop. Wrap and style the output inside arenderer. - Removed the
childrenprop (completion content). Render the completed state inside arenderer. - Removed the legacy
countprop and the legacy simple-countdown path. - Removed
prop-types. TypeScript types are now the only prop contract; there are no runtime prop warnings. onCompleteno longer accepts the legacy zero-argument form. The signature is(timeDelta, completedOnStart).
useCountdownhook, a public React adapter returning the same render props as the component.- Subpath entry points:
react-countdown/componentandreact-countdown/hookto import only what you need (both share the core). resetKeyprop to restart the countdown without remounting (React'skeystill works to remount).freezePropsprop to opt out of prop tracking after mount.CountdownStatusenum is now exported, plus agetStatus()method on the API.refresh()method on the API to force an immediate recompute and re-render against the current clock (e.g. from avisibilitychangelistener after the interval was throttled in a background tab).- Dual ESM + CJS build with bundled type definitions and
sideEffects: falsefor tree-shaking.
| v2 | v3 |
|---|---|
ref.current.getApi().start() |
ref.current.api.start() |
<Countdown className="..." /> |
apply styling inside a renderer |
<Countdown>{completedContent}</Countdown> |
render the completed state inside renderer |
<Countdown count={n} /> |
use date (the legacy count path is gone) |
| React 16 / 17 | React 18+ |
No changes are needed for the remaining props, lifecycle callbacks, the api render prop / ref.current.api path, or the zeroPad / calcTimeDelta / formatTimeDelta helpers.