Skip to content

feat(useCountdown): add useCountdown hook#233

Closed
JeongHwan-dev wants to merge 1 commit intotoss:mainfrom
JeongHwan-dev:feat/add-use-countdown
Closed

feat(useCountdown): add useCountdown hook#233
JeongHwan-dev wants to merge 1 commit intotoss:mainfrom
JeongHwan-dev:feat/add-use-countdown

Conversation

@JeongHwan-dev
Copy link
Contributor

@JeongHwan-dev JeongHwan-dev commented May 7, 2025

Overview

Add useCountdown hook: useCountdown is a React hook that manages a countdown timer with precise control. It provides functions to start, pause, resume, and reset the countdown. The hook tracks the current count value and supports both incrementing and decrementing modes.

Checklist

  • Did you write the test code?
  • Have you run yarn run fix to format and lint the code and docs?
  • Have you run yarn run test:coverage to make sure there is no uncovered line?
  • Did you write the JSDoc?

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (c76f1fe) to head (3eab881).
Report is 6 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #233   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           33        34    +1     
  Lines          839       884   +45     
  Branches       254       265   +11     
=========================================
+ Hits           839       884   +45     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@seungrodotlee
Copy link
Contributor

How about changing it to a more intuitive name? (e.g., useTimer)

@JeongHwan-dev JeongHwan-dev marked this pull request as draft May 8, 2025 14:20
@kimyouknow
Copy link
Collaborator

@JeongHwan-dev Thank you for the excellent implementation — the code quality is impressive (252 lines of tests, clean TypeScript, great use of existing hooks).

Before merging, we'd like to discuss one scope question:

useCountdown is a composition of existing primitives (useCounter + useBooleanState + useInterval). We're currently discussing whether react-simplikit should focus on primitive building blocks that users compose themselves, or also include composed convenience hooks.

If we include useCountdown, similar composed hooks (useTimer, useStopwatch, etc.) would follow the same precedent.

We'd like to align with @zztnrudzz13 on this before proceeding. Will follow up soon!

@kimyouknow
Copy link
Collaborator

@JeongHwan-dev Following up — after team discussion, we've decided that composed hooks like useCountdown fall outside our library's scope.

react-simplikit focuses on providing primitive building blocks only.

useCountdown composes existing primitives (useCounter + useBooleanState+ useInterval), and including it would set a precedent for similar composed hooks (useTimer, useStopwatch, etc.).

Same rationale as #338, #343 — we're focusing on primitive building blocks only.

Users can compose these primitives to build their own countdown logic. Thank you for the great implementation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants