You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/blog/2019-02-23-is-react-translated-yet.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ In the past, React community members have created unofficial translations for [C
23
23
24
24
If you would like to help out on a current translation, check out the [Languages](/languages) page and click on the "Contribute" link for your language.
25
25
26
-
Can't find your language? If you'd like to maintain your langauge's translation fork, follow the instructions in the [translation repo](https://github.com/reactjs/reactjs.org-translation#starting-a-new-translation)!
26
+
Can't find your language? If you'd like to maintain your language's translation fork, follow the instructions in the [translation repo](https://github.com/reactjs/reactjs.org-translation#starting-a-new-translation)!
Copy file name to clipboardExpand all lines: content/docs/hooks-faq.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -567,7 +567,7 @@ Depending on your use case, there are a few more options described below.
567
567
568
568
Let's see why this matters.
569
569
570
-
If you specify a [list of dependencies](/docs/hooks-reference.html#conditionally-firing-an-effect) as the last argument to `useEffect`, `useMemo`, `useCallback`, or `useImperativeHandle`, it must include all values used inside that participate in the React data flow. That includes props, state, and anything derived from them.
570
+
If you specify a [list of dependencies](/docs/hooks-reference.html#conditionally-firing-an-effect) as the last argument to `useEffect`, `useMemo`, `useCallback`, or `useImperativeHandle`, it must include all values used inside that participate in the React data flow. That includes props, state, and anything derived from them.
571
571
572
572
It is **only** safe to omit a function from the dependency list if nothing in it (or the functions called by it) references props, state, or values derived from them. This example has a bug:
573
573
@@ -618,7 +618,7 @@ This also allows you to handle out-of-order responses with a local variable insi
618
618
const json = await response.json();
619
619
if (!ignore) setProduct(json);
620
620
}
621
-
621
+
622
622
fetchProduct();
623
623
return () => { ignore = true };
624
624
}, [productId]);
@@ -677,7 +677,7 @@ function Counter() {
677
677
678
678
The empty set of dependencies, `[]`, means that the effect will only run once when the component mounts, and not on every re-render. The problem is that inside the `setInterval` callback, the value of `count` does not change, because we've created a closure with the value of `count` set to `0` as it was when the effect callback ran. Every second, this callback then calls `setCount(0 + 1)`, so the count never goes above 1.
679
679
680
-
Specifying `[count]` as a list of dependencies would fix the bug, but would cause the interval to be reset on every change. Effectively, each `setInterval` would get one chance to execute before being cleared (similar to a `setTimout`.) That may not be desirable. To fix this, we can use the [functional update form of `setState`](/docs/hooks-reference.html#functional-updates). It lets us specify *how* the state needs to change without referencing the *current* state:
680
+
Specifying `[count]` as a list of dependencies would fix the bug, but would cause the interval to be reset on every change. Effectively, each `setInterval` would get one chance to execute before being cleared (similar to a `setTimeout`.) That may not be desirable. To fix this, we can use the [functional update form of `setState`](/docs/hooks-reference.html#functional-updates). It lets us specify *how* the state needs to change without referencing the *current* state:
0 commit comments