Releases: sheinsight/react-use
v1.7.0
🚀 Features
- Add new Hook
useForm
to handle form state, both for controlled and uncontrolled forms - by @vikiboss (44137) - Add new Hook
useWebSocket
to handle WebSocket connections - by @vikiboss (edc56) - Add new Hook
useVersionedAction
to run versioned action - by @vikiboss (f34bf) - Add new Hook
usePagingList
to handle paging list - by @vikiboss (a3b15) - Add new Hook
useInfiniteList
to handle infinite list - by @vikiboss (1538c) - useInfiniteScroll:
- useMultiSelect:
- usePagination:
🐞 Bug Fixes
- useInfiniteScroll:
- useMultiSelect:
- useQuery:
View changes on GitHub
🚀 功能新增
- 新增
useForm
Hook,用于处理表单状态,适用于受控与非受控表单 - 由 @vikiboss 提供 (44137) - 新增
useWebSocket
Hook,用于处理 WebSocket 连接 - 由 @vikiboss 提供 (edc56) - 新增
useVersionedAction
Hook,用以执行基于版本的动作 - 由 @vikiboss 提供 (f34bf) - 新增
usePagingList
Hook,用于处理分页列表 - 由 @vikiboss 提供 (a3b15) - 新增
useInfiniteList
Hook,用于处理无限列表 - 由 @vikiboss 提供 (1538c) - useInfiniteScroll:
- useMultiSelect:
- usePagination:
🐞 修复
- useInfiniteScroll:
- useMultiSelect:
- useQuery:
在 GitHub 上查看更改
v1.6.0
🚀 Features
- Add new Hook
useVirtualList
to improve large list render performance, support both vertical and horizontal mode. - by @vikiboss (429cc) - Add exports for
package.json
- by @vikiboss (df087)
🐞 Bug Fixes
- useInfiniteScroll: Fix
isLoading
&isLoadDone
state not update expectedly - by @vikiboss (3ef21) - useQuery: Fix
refresh
not controlled bydebounce
andthrottle
options - by @vikiboss (701c7)
View changes on GitHub
🚀 功能特性
- 新增
useVirtualList
Hook,用于提升大型列表的渲染性能,支持垂直和水平模式。 - 由 @vikiboss 提供 (429cc) - 在
package.json
中添加了导出项。 - 由 @vikiboss 提供 (df087)
🐞 修复的错误
- useInfiniteScroll:修复了
isLoading
和isLoadDone
状态更新不如预期的问题。 - 由 @vikiboss 提供 (3ef21) - useQuery:修复了
refresh
功能不受debounce
和throttle
选项控制的问题。 - 由 @vikiboss 提供 (701c7)
在 GitHub 上查看更改
v1.5.0
🚀 Features
-
Add new Hook
useQuery
renamed fromuseRequest
- by @vikiboss (11f65) -
Add internal Hooks
useTrackedRefState
&useVersionedAction
- by @vikiboss (783fa) -
Add new Hook
useFirstRender
to check whether it's the first render. - by @vikiboss (aee59) -
useAsyncFn:
-
useClipboard:
-
useClipboardItems:
-
useLatest:
-
useLoadingSlowFn:
-
usePagination:
-
usePerformanceObserver:
-
usePrevious:
-
useQuery:
-
useRequest:
-
useWebObserver:
🐞 Bug Fixes
View changes on GitHub
🚀 功能
-
添加了新的 Hook
useQuery
,原名useRequest
- 由 @vikiboss 贡献 <samp>(11f65)</samp> -
添加了内部 Hooks
useTrackedRefState
和useVersionedAction
- 由 @vikiboss 贡献 <samp>(783fa)</samp> -
新增
useFirstRender
Hook 用于检查是否为首次渲染。- 由 @vikiboss 贡献 <samp>(aee59)</samp> -
useAsyncFn:
- 重写为使用自动跟踪状态以提高性能 - 由 @vikiboss 贡献 <samp>(3ec25)</samp>
-
useClipboard:
- 支持
onCopy
和onCopiedReset
回调 - 由 @vikiboss 贡献 <samp>(38718)</samp> - 重写为使用自动跟踪状态以提高性能 - 由 @vikiboss 贡献 <samp>(5ce34)</samp>
- 增强
legacyCopy
行为 - 由 @vikiboss 贡献 <samp>(bccfe)</samp>
- 支持
-
useClipboardItems:
- 支持
onCopy
和onCopiedReset
回调 - 由 @vikiboss 贡献 <samp>(0d1e7)</samp> - 重写为使用自动跟踪状态以提高性能 - 由 @vikiboss 贡献 <samp>(2d91a)</samp>
- 支持
-
useLatest:
- 减少不必要的赋值 - 由 @vikiboss 贡献 <samp>(3cad8)</samp>
-
useLoadingSlowFn:
- 重写为使用自动跟踪状态以提高性能 - 由 @vikiboss 贡献 <samp>(97226)</samp>
-
usePagination:
- 支持直接返回切片列表(在选项中传递
list
),并在返回值中添加indexStart
,indexEnd
- 由 @vikiboss 贡献 <samp>(2ed32)</samp>
- 支持直接返回切片列表(在选项中传递
-
usePerformanceObserver:
- 支持
entryTypes
检查 - 由 @vikiboss 贡献 <samp>(d9f39)</samp>
- 支持
-
usePrevious:
- 支持使用
deep
选项来深度比较上一个状态 - 由 @vikiboss 贡献 <samp>(204b4)</samp>
- 支持使用
-
useQuery:
- 重写为使用自动跟踪状态以提高性能 - 由 @vikiboss 贡献 <samp>(72adc)</samp>
- 支持
onErrorRetryFailed
选项 - 由 @vikiboss 贡献 <samp>(357e7)</samp>
-
useRequest:
- 弃用
useRequest
,请改用useQuery
。- 由 @vikiboss 贡献 <samp>(26c51)</samp>
- 弃用
-
useWebObserver:
- 对特定观察者支持额外的
supported
检查 - 由 @vikiboss 贡献 <samp>(d30a9)</samp>
- 对特定观察者支持额外的
🐞 修复
- useQuery: 修复全局 mutate 参数错误 - 由 @vikiboss 贡献 <samp>(3d35a)</samp>
在 GitHub 上查看更改
v1.4.0
Add useRequest
Hook
useRequest
is a common hook for data fetching, supports cache, automatic refresh, and many awesome features.
- Support basic async operations state management (loading, data, error, params, etc.)
- Support many lifecycle hooks, such as onBefore, onSuccess, onError, etc.
- Support continuous automatic refresh, manual refresh, and refresh control
- Support automatic refresh when the network is reconnected, the page is focused, etc.
- Support cross-platform visibility and online judgment to control automatic refresh
- Support error retry, error retry interval, and error retry count
- Support throttle and debounce for manual refresh
- Support custom loading timeout, loading slow detection, and loading slow timeout
- Support cache, cache expiration time, and cache provider (SWR)
- Support clear cache, get cache, and mutate cache globally or locally
- Support pausable to control internal automatic behavior
- Support manual refresh, automatic refresh, and manual control refresh
🚀 Features
- New Hook
useInputComposition
to track composition state ofinput
element - by @vikiboss (5be4b) - New Hook
useLoadingSlowFn
to track loading slow state - by @vikiboss (732fa) - New Hook
useReConnect
to run a callback when re-connect - by @vikiboss (772ab) - New Hook
useReFocus
to run a callback when re-focus - by @vikiboss (88cc9) - New Hook
useRetryFn
to create a function with retry mechanism - by @vikiboss (2eceb) - createSingleLoading:
- useAsyncFn:
- Support
onMutate
,onCancel
,onRefresh
callbacks - by @vikiboss (a1298) - Support
onError
callback - by @vikiboss (072f0) - Support lifecycle callbacks & improve render performance - by @vikiboss (fe1b8)
mutate
&refresh
support params - by @vikiboss (02ff0)- Support
compare
options to control render behavior - by @vikiboss (dfed2)
- Support
- useReactive:
🐞 Bug Fixes
- useAsyncFn: Fix race condition bug - by @vikiboss (9071e)
- useResetState: Fix returned
initialValue
- by @vikiboss (5e128) - useToggle: Fix hook returned value - by @vikiboss (dd976)
🏎 Performance
View changes on GitHub
添加 useRequest
钩子
useRequest
是一个常用的数据获取钩子,支持缓存、自动刷新以及许多其他优秀特性。
- 支持基本异步操作状态管理(加载中、数据、错误、参数等)
- 支持多种生命周期钩子,例如 onBefore、onSuccess、onError 等
- 支持连续自动刷新、手动刷新和刷新控制
- 支持网络重新连接、页面聚焦等时自动刷新
- 支持跨平台可见性和在线判断来控制自动刷新
- 支持错误重试、错误重试间隔和错误重试次数
- 支持对手动刷新进行节流和防抖处理
- 支持自定义加载超时、加载缓慢检测和加载缓慢超时
- 支持缓存、缓存过期时间和缓存提供者(SWR)
- 支持全局或局部地清除缓存、获取缓存和变更缓存
- 支持暂停以控制内部自动行为
- 支持手动刷新、自动刷新和手动控制刷新
🚀 功能
- 新钩子
useInputComposition
用于追踪input
元素的组合状态 - 由 @vikiboss 提供 (5be4b) - 新钩子
useLoadingSlowFn
用于追踪加载缓慢状态 - 由 @vikiboss 提供 (732fa) - 新钩子
useReConnect
用于重新连接时运行回调函数 - 由 @vikiboss 提供 (772ab) - 新钩子
useReFocus
用于重新聚焦时运行回调函数 - 由 @vikiboss 提供 (88cc9) - 新钩子
useRetryFn
用于创建具有重试机制的函数 - 由 @vikiboss 提供 (2eceb) - createSingleLoading:
- useAsyncFn:
- useReactive:
🐞 修复
- useAsyncFn: 修复竞态条件 bug - 由 @vikiboss 提供 (9071e)
- useResetState: 修复返回的
initialValue
- 由 @vikiboss 提供 (5e128) - useToggle: 修复钩子返回值 - 由 @vikiboss 提供 (dd976)
🏎 性能优化
在 GitHub 上查看更改
v1.3.0
v1.2.1
v1.2.0
🚀 Features
🐞 Bug Fixes
- useActiveElement: Use
useLayoutMount
to prevent layout jitter - by @vikiboss (f8e25) - useBreakpoints: Use
useDeepCompareLayoutEffect
to prevent layout jitter - by @vikiboss (5a588) - useCssVar: Use
useLayoutMount
to prevent layout jitter - by @vikiboss (7935a) - useFavicon: Use
useLayoutMount
to prevent layout jitter - by @vikiboss (d0c82) - useFocus: Use
useLayoutMount
to prevent layout jitter - by @vikiboss (f2950) - useMediaQuery: Use
useDeepCompareLayoutEffect
to prevent layout jitter - by @vikiboss (11f16) - useNetwork: Use
useIsomorphicLayoutEffect
to prevent layout jitter - by @vikiboss (04255) - useSupported: Use
useIsomorphicLayoutEffect
to prevent layout jitter - by @vikiboss (b5378) - useTextDirection: Use
useLayoutMount
to prevent layout jitter - by @vikiboss (fc474) - useUrlSearchParams: Use
useLayoutMount
to prevent layout jitter - by @vikiboss (584d1) - useWindowFocus: Use
useLayoutMount
to prevent layout jitter - by @vikiboss (273e9) - useWindowScroll: Use
useLayoutMount
to prevent layout jitter - by @vikiboss (d136b) - useWindowSize: Use
useLayoutMount
to prevent layout jitter - by @vikiboss (c1d0b)
View changes on GitHub
v1.1.4
🐞 Bug Fixes
View changes on GitHub
v1.1.3
🐞 Bug Fixes
- useInfiniteScroll: Fix
onScroll
event not being triggered when target scroll - by @vikiboss (73a9c) - useParallax: Remove unused options. - by @vikiboss (10f6b)
- useTargetElement: Advance the reffable value resolve time in target element - by @vikiboss (e3766)
- useTitle: Correct unify type name - by @vikiboss (19338)
View changes on GitHub
v1.1.2
🐞 Bug Fixes
- createSingleLoading, useReactive: Use
create
option to avoid import and ESM require error - by @vikiboss (2b854)