Skip to content

Commit 828dd4d

Browse files
Merge branch 'master' of https://github.com/reactjs/reactjs.org into sync-5dca78b7
2 parents bc3b4ac + 5dca78b commit 828dd4d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

content/community/conferences.md

+5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ September 26-28, 2019 in Alicante, Spain
5252

5353
[Website](http://reactalicante.es/) - [Twitter](https://twitter.com/reactalicante) - [Facebook](https://www.facebook.com/ReactAlicante)
5454

55+
### React Conf 2019 {#react-conf-2019}
56+
October 24-25, 2019 in Henderson, Nevada USA
57+
58+
[Website](https://conf.reactjs.org/) - [Twitter](https://twitter.com/reactjs)
59+
5560
### React Advanced 2019 {#react-advanced-2019}
5661
October 25, 2019 in London, UK
5762

content/docs/hooks-faq.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ Depending on your use case, there are a few more options described below.
567567
568568
Let's see why this matters.
569569

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.
571571

572572
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:
573573

@@ -618,7 +618,7 @@ This also allows you to handle out-of-order responses with a local variable insi
618618
const json = await response.json();
619619
if (!ignore) setProduct(json);
620620
}
621-
621+
622622
fetchProduct();
623623
return () => { ignore = true };
624624
}, [productId]);
@@ -677,7 +677,7 @@ function Counter() {
677677

678678
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.
679679

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:
681681

682682
```js{6,9}
683683
function Counter() {

0 commit comments

Comments
 (0)