Skip to content

Commit 6ecaf4b

Browse files
authored
Merge pull request #42 from reactjs/sync-cb5a61cd
Sync with reactjs.org @ cb5a61c
2 parents e3e6260 + 7b4f99d commit 6ecaf4b

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
@@ -610,14 +610,16 @@ function ProductPage({ productId }) {
610610

611611
This also allows you to handle out-of-order responses with a local variable inside the effect:
612612

613-
```js{2,6,8}
613+
```js{2,6,10}
614614
useEffect(() => {
615615
let ignore = false;
616616
async function fetchProduct() {
617617
const response = await fetch('http://myapi/product/' + productId);
618618
const json = await response.json();
619619
if (!ignore) setProduct(json);
620620
}
621+
622+
fetchProduct();
621623
return () => { ignore = true };
622624
}, [productId]);
623625
```

0 commit comments

Comments
 (0)