From 7e0a7f3f187ab100cbe54e25117762e787eb6ff1 Mon Sep 17 00:00:00 2001 From: jeffjing Date: Thu, 21 May 2020 21:33:52 +0800 Subject: [PATCH 1/2] make statement more clearly It seems like the latter sentence has nothing to do with the previous sentence, thus they probably shouldn't be in the same paragraph. --- api.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) From dacbef230346abdde60f989bcd26c028e3a88f39 Mon Sep 17 00:00:00 2001 From: jeffjing Date: Thu, 21 May 2020 21:35:20 +0800 Subject: [PATCH 2/2] sync with English version --- zh/api.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)