Repository navigation
v3.0.0
Release Notes for @jbpark/use-hooks 3.0.0
This major release brings significant improvements and redesigns to several core hooks in the @jbpark/use-hooks library, making it more robust, efficient, and easier to use.
Major Changes
- Improved Error Handling in
useImage: Theerrorproperty now returns a realErrorobject instead of a string or event, with the original event attached aserror.causefor debugging purposes. - Removed
useTimeline: This hook had zero consumers and was removed to simplify the library and reduce maintenance overhead. - Redesigned
useScrollToElementsAPI: The hook now uses key-based registration and scrolling, eliminating index-based registration and leftovernullholes. - Improved
useClickOutside: The hook now takes the "inside" ref(s) as an argument instead of creating and returning one, and adds anescapeoption to close on the Escape key. - Redesigned
useIntersectionObserver: The hook now returns[ref, { entry, isIntersecting }]and adds afreezeOnceVisibleoption to disconnect the observer when the target becomes intersecting.
Minor Changes
- Added
useDebouncedValueanduseThrottledCallback: These hooks provide debounced and throttled values and callbacks, respectively, rounding out the library's value/callback pairing. - Added
useEventListener,usePrevious, anduseToggle: These hooks provide utility functions for event listeners, previous values, and toggling state.
What's Changed
- 💥 feat!: remove useTimeline by @pjb0811 in #124
- 💥 feat!: redesign useScrollToElements around keyed registration by @pjb0811 in #125
- 🐛 fix: recognize any changeset file, not just pr-<PR#>.md by @pjb0811 in #127
- ✨ feat: add useMergedRef by @pjb0811 in #128
- 💥 feat!: redesign useClickOutside around caller-supplied refs by @pjb0811 in #129
- ✨ feat: add useResizeObserver and useMutationObserver by @pjb0811 in #130
- ✨ feat: add useDebouncedValue and useThrottledCallback by @pjb0811 in #131
- ✨ feat: add useKeyPress by @pjb0811 in #132
- ✨ feat: add useFileDrop by @pjb0811 in #133
- 💥 feat!: redesign useIntersectionObserver return shape and add freezeOnceVisible by @pjb0811 in #135
- 💥 fix!: use a real Error for useImage's error state by @pjb0811 in #136
- ✨ feat: add useTimeout and useInterval by @pjb0811 in #134
- ✨ feat: add useEventListener, usePrevious, and useToggle by @pjb0811 in #137
- 🔖 chore: version packages by @github-actions[bot] in #126
Full Changelog: v2.11.0...v3.0.0