Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

make statement more clearly #32

Merged
merged 2 commits into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,9 @@ watchEffect(onInvalidate => {
})
```

We are registering the invalidation callback via a passed-in function instead of returning it from the callback (like React `useEffect`) because the return value is important for async error handling. It is very common for the effect function to be an async function when performing data fetching:
We are registering the invalidation callback via a passed-in function instead of returning it from the callback (like React `useEffect`) because the return value is important for async error handling.

It is very common for the effect function to be an async function when performing data fetching:

```js
const data = ref(null)
Expand Down
4 changes: 3 additions & 1 deletion zh/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,9 @@ watchEffect((onInvalidate) => {
})
```

我们之所以是通过传入一个函数去注册失效回调,而不是从回调返回它(如 React `useEffect` 中的方式),是因为返回值对于异步错误处理很重要。在执行数据请求时,副作用函数往往是一个异步函数:
我们之所以是通过传入一个函数去注册失效回调,而不是从回调返回它(如 React `useEffect` 中的方式),是因为返回值对于异步错误处理很重要。

在执行数据请求时,副作用函数往往是一个异步函数:

```js
const data = ref(null)
Expand Down