Skip to content

Commit

Permalink
Sync with reactjs.org @ cb5a61c (#342)
Browse files Browse the repository at this point in the history
* Update thinking-in-react.md (#2095)

Please refer to https://justsimply.dev for the thinking behind these proposed changes.

* Update thinking-in-react.md (#2098)

Follow up to reactjs/react.dev#2095 (comment)

* Add missing function call to example (#2102)

An example for useEffect omitted the actual invocation of the function in question.

* resolve merge conflicts
  • Loading branch information
reactjs-translation-bot authored and another-guy committed Jun 28, 2019
1 parent 0facb4d commit b750797
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion content/docs/hooks-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -613,14 +613,16 @@ function ProductPage({ productId }) {

Это также позволяет обрабатывать ответы, пришедшие не в порядке запросов, с помощью локальной переменной внутри эффекта:

```js{2,6,8}
```js{2,6,10}
useEffect(() => {
let ignore = false;
async function fetchProduct() {
const response = await fetch('http://myapi/product/' + productId);
const json = await response.json();
if (!ignore) setProduct(json);
}
fetchProduct();
return () => { ignore = true };
}, [productId]);
```
Expand Down

0 comments on commit b750797

Please sign in to comment.