feat(useInputState): support lazy initialization for initial value - #469
Merged
Conversation
🦋 Changeset detectedLatest commit: 17b59aa The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #469 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 67 67
Lines 2204 2204
Branches 711 711
=========================================
Hits 2204 2204 🚀 New features to boost your workflow:
|
hyesungoh
reviewed
Sep 4, 2026
hyesungoh
left a comment
Member
There was a problem hiding this comment.
Thank you for your contribution! 👍
can you update this korean docs too? 🙏
Contributor
Author
|
Thanks for pointing this out! I've updated the Korean docs. |
hyesungoh
approved these changes
Sep 6, 2026
hyesungoh
left a comment
Member
There was a problem hiding this comment.
Thanks for your contribution! 👍
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
useInputState is a custom hook built on top of React's useState. However, because the initialValue type was limited to string, it did not support the lazy initializer provided by useState.
This PR expands the initialValue type to accept string | (() => string), allowing the initial value to be computed lazily and avoiding unnecessary recalculation on re-renders.
Checklist
yarn run fixto format and lint the code and docs?yarn run test:coverageto make sure there is no uncovered line?