Skip to content

Commit b750797

Browse files
Sync with reactjs.org @ cb5a61c (#342)
* 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
1 parent 0facb4d commit b750797

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

content/docs/hooks-faq.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,14 +613,16 @@ function ProductPage({ productId }) {
613613

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

616-
```js{2,6,8}
616+
```js{2,6,10}
617617
useEffect(() => {
618618
let ignore = false;
619619
async function fetchProduct() {
620620
const response = await fetch('http://myapi/product/' + productId);
621621
const json = await response.json();
622622
if (!ignore) setProduct(json);
623623
}
624+
625+
fetchProduct();
624626
return () => { ignore = true };
625627
}, [productId]);
626628
```

0 commit comments

Comments
 (0)