Skip to content

Commit

Permalink
docs(cn): perfect learn/reusing-logic-with-custom-hooks (#1389)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryomahan authored Nov 30, 2023
1 parent 780b3ad commit 39146e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/content/learn/reusing-logic-with-custom-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ React 应用是由组件构成,而组件由内置或自定义 Hook 构成。

不。没有 **调用** Hook 的函数不需要 **变成** Hook。

如果函数没有调用任何 Hook,请避免使用 `use` 前缀。 而是 **不带** `use` 前缀把它当成常规函数去写。例如下面的 `useSorted` 没有调用 Hook,所以叫它 `getSorted`
如果你创建的函数没有调用任何 Hook 方法,在命名时应避免使用 `use` 前缀,把它当成一个常规函数去命名。如下案例中的 `useSorted` 函数就没有调用任何 Hook 方法,所以更推荐用 `getSorted` 来命名

```js
// 🔴 Avoid: 没有调用其他Hook的Hook
Expand Down

0 comments on commit 39146e8

Please sign in to comment.