From 7907199f732104ba8e4f99e7ec08a8da4a382f1c Mon Sep 17 00:00:00 2001 From: Junerver Date: Mon, 11 Mar 2024 08:57:06 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D:=20update=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 49 ++++++++++++++++++++++++------------------------- README.zh-CN.md | 46 ++++++++++++++++++++++++---------------------- 2 files changed, 48 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 7914466a..cb35056c 100644 --- a/README.md +++ b/README.md @@ -25,31 +25,30 @@ using similar API names. The hooks that have been implemented so far are as follows: -| hook name | effect | -|---------------| ------------------------------------------------------------ | -| useRequest | Manage network requests and implement: manual and automatic triggering; life cycle callbacks; refresh; mutate changes; cancel requests; polling; Ready; dependency refresh; debounce, throttle; error retry; | -| useBoolean | Hook to manage boolean state. | -| useContext | just like react | -| useCreation | `useCreation` is the replacement for `useRef`. | -| useDebounce | A hook that deal with the debounced value. | -| useDebounceFn | A hook that deal with the debounced function. | -| useEffect | just like react | -| useInterval | A hook that handles the `setInterval` timer function. | -| useLatest | A Hook that returns the latest value, effectively avoiding the closure problem. | -| useMount | A hook that executes a function after the component is mounted. | -| useNetwork | A hook for obtaining network connection status and type. | -| usePrevious | A Hook to return the previous state. | -| useReducer | just like react | -| useRef | just like react | -| useState | just like react | -| useThrottle | A hook that deal with the throttled value. | -| useThrottleFn | A hook that deal with the throttled function. | -| useToggle | A hook that toggle states. | -| useTimeout | A hook that handles the `setTimeout` timer function. | -| useUndo | A Hook for handling undo and redo. | -| useUnmount | A hook that executes the function right before the component is unmounted. | -| useUpdate | A hook that returns a function which can be used to force the component to re-render. | - +| hook name | effect | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| [useRequest](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseRequestExample.kt) | Manage network requests and implement: manual and automatic triggering; life cycle callbacks; refresh; mutate changes; cancel requests; polling; Ready; dependency refresh; debounce, throttle; error retry; | +| [useBoolean](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseBooleanExample.kt) | Hook to manage boolean state. | +| [useContext](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseContextExample.kt) | just like react | +| [useCreation](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseCreationExample.kt) | `useCreation` is the replacement for `useRef`. | +| [useDebounce](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseDebounceExample.kt) | A hook that deal with the debounced value. | +| [useDebounceFn](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseDebounceFnExample.kt) | A hook that deal with the debounced function. | +| [useEffect](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseEffectExample.kt) | just like react | +| [useInterval](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseIntervalExample.kt) | A hook that handles the `setInterval` timer function. | +| [useLatest](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseLatestExample.kt) | A Hook that returns the latest value, effectively avoiding the closure problem. | +| [useMount](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseMountExample.kt) | A hook that executes a function after the component is mounted. | +| [useNetwork](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseNetworkExample.kt) | A hook for obtaining network connection status and type. | +| [usePrevious](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UsePreviousExample.kt) | A Hook to return the previous state. | +| [useReducer](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseReducerExample.kt) | just like react | +| [useRef](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseRefExample.kt) | just like react | +| [useState](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseStateExample.kt) | just like react | +| [useThrottle](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseThrottleExample.kt) | A hook that deal with the throttled value. | +| [useThrottleFn](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseThrottleFnExample.kt) | A hook that deal with the throttled function. | +| [useToggle](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseToggleExample.kt) | A hook that toggle states. | +| [useTimeout](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseTimeoutExample.kt) | A hook that handles the `setTimeout` timer function. | +| [useUndo](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseUndoExample.kt) | A Hook for handling undo and redo. | +| [useUnmount](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseUnmountExample.kt) | A hook that executes the function right before the component is unmounted. | +| [useUpdate](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseUpdateExample.kt) | A hook that returns a function which can be used to force the component to re-render. | ## Add to dependencies ```groovy diff --git a/README.zh-CN.md b/README.zh-CN.md index 2ba151bb..60b4f14d 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -20,28 +20,30 @@ | 函数名称 | 效果 | |---------------|----------------------------------------------------------------------| -| useRequest | 管理网络请求,实现了:手动、自动触发;生命周期回调;刷新;mutate变更;取消请求;轮询;Ready;依赖刷新;防抖、节流;错误重试; | -| useBoolean | 管理 boolean 状态的 Hook。 | -| useContext | just like react | -| useCreation | 用来替换 useRef | -| useDebounce | 用来处理防抖值的 Hook。 | -| useDebounceFn | 用来处理防抖函数的 Hook。 | -| useEffect | just like react | -| useInterval | 一个可以处理 setInterval 的 Hook。 | -| useLatest | 返回当前最新值的 Hook,可以避免在使用解构写法时的闭包问题。 | -| useMount | 只在组件初始化时执行的 Hook。 | -| useNetwork | 获取网络连接状态、类型 | -| usePrevious | 保存上一次状态的 Hook。 | -| useReducer | 一个可以在组件内使用的极简 redux | -| useRef | just like react | -| useState | just like react | -| useThrottle | 用来处理节流值的 Hook。 | -| useThrottleFn | 用来处理函数节流的 Hook。 | -| useToggle | 用于在两个状态值间切换的 Hook。 | -| useTimeout | 用于执行定时任务 | -| useUndo | 用于处理撤销、重做的 Hook。 | -| useUnmount | 在组件卸载(unmount)时执行的 Hook。 | -| useUpdate | useUpdate 会返回一个函数,调用该函数会强制组件重新渲染。 | +| [useRequest](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseRequestExample.kt) | 管理网络请求,实现了:手动、自动触发;生命周期回调;刷新;mutate变更;取消请求;轮询;Ready;依赖刷新;防抖、节流;错误重试; | +| [useBoolean](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseBooleanExample.kt) | 管理 boolean 状态的 Hook。 | +| [useContext](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseContextExample.kt) | just like react | +| [useCreation](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseCreationExample.kt) | 用来替换 useRef | +| [useDebounce](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseDebounceExample.kt) | 用来处理防抖值的 Hook。 | +| [useDebounceFn](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseDebounceFnExample.kt) | 用来处理防抖函数的 Hook。 | +| [useEffect](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseEffectExample.kt) | just like react | +| [useInterval](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseIntervalExample.kt) | 一个可以处理 setInterval 的 Hook。 | +| [useLatest](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseLatestExample.kt) | 返回当前最新值的 Hook,可以避免在使用解构写法时的闭包问题。 | +| [useMount](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseMountExample.kt) | 只在组件初始化时执行的 Hook。 | +| [useNetwork](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseNetworkExample.kt) | 获取网络连接状态、类型 | +| [usePrevious](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UsePreviousExample.kt) | 保存上一次状态的 Hook。 | +| [useReducer](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseReducerExample.kt) | 一个可以在组件内使用的极简 redux | +| [useRef](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseRefExample.kt) | just like react | +| [useState](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseStateExample.kt) | just like react | +| [useThrottle](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseThrottleExample.kt) | 用来处理节流值的 Hook。 | +| [useThrottleFn](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseThrottleFnExample.kt)| 用来处理函数节流的 Hook。 | +| [useToggle](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseToggleExample.kt) | 用于在两个状态值间切换的 Hook。 | +| [useTimeout](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseTimeoutExample.kt) | 用于执行定时任务 | +| [useUndo](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseUndoExample.kt) | 用于处理撤销、重做的 Hook。 | +| [useUnmount](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseUnmountExample.kt) | 在组件卸载(unmount)时执行的 Hook。 | +| [useUpdate](https://github.com/junerver/ComposeHooks/blob/master/app/src/main/java/xyz/junerver/composehooks/example/UseUpdateExample.kt) | useUpdate 会返回一个函数,调用该函数会强制组件重新渲染。 | + + ## 添加依赖 ```groovy