diff --git a/api.md b/api.md index 9a97400..51627ab 100644 --- a/api.md +++ b/api.md @@ -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) diff --git a/zh/api.md b/zh/api.md index c1ee8cf..b884aa0 100644 --- a/zh/api.md +++ b/zh/api.md @@ -393,7 +393,9 @@ watchEffect((onInvalidate) => { }) ``` -我们之所以是通过传入一个函数去注册失效回调,而不是从回调返回它(如 React `useEffect` 中的方式),是因为返回值对于异步错误处理很重要。在执行数据请求时,副作用函数往往是一个异步函数: +我们之所以是通过传入一个函数去注册失效回调,而不是从回调返回它(如 React `useEffect` 中的方式),是因为返回值对于异步错误处理很重要。 + +在执行数据请求时,副作用函数往往是一个异步函数: ```js const data = ref(null)