Migrate to v3


Introduction

usehooks-ts bumped to version 3 and it's a major release with a lot of changes and improvements.

Changes

Removed hooks

Some hooks were removed from the library. The following hooks were removed:

  • useDebounce: Replaced by both useDebounceValue and useDebounceCallback.
  • useFetch: Prefer other solutions like React server components, your framework's data fetching solution, or a caching library like SWR or React Query.
  • useElementSize: Replaced by more performant useResizeObserver.
  • useLockedBody: Replaced by more generic useScrollLock.
  • useIsFirstRender: Not comply with the React functional mindset.
  • useSsr: It was not a React hook.
  • useEffectOnce: Unnecessary abstraction, prefer built-in React hooks.
  • useUpdateEffect: Unnecessary abstraction, prefer built-in React hooks.
  • useImageOnLoad: Too opinionated.

Updated hook signatures

Some hook signature have been updated introducing breaking changes.