Skip to content

Commit ede1196

Browse files
Merge branch 'master' of https://github.com/reactjs/reactjs.org into sync-cb5a61cd
2 parents 341cb6a + cb5a61c commit ede1196

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
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
```

content/docs/thinking-in-react.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The first thing you'll want to do is to draw boxes around every component (and s
3737

3838
But how do you know what should be its own component? Use the same techniques for deciding if you should create a new function or object. One such technique is the [single responsibility principle](https://en.wikipedia.org/wiki/Single_responsibility_principle), that is, a component should ideally only do one thing. If it ends up growing, it should be decomposed into smaller subcomponents.
3939

40-
Since you're often displaying a JSON data model to a user, you'll find that if your model was built correctly, your UI (and therefore your component structure) will map nicely. That's because UI and data models tend to adhere to the same *information architecture*, which means the work of separating your UI into components is often trivial. Break it up into components that represent exactly one piece of your data model.
40+
Since you're often displaying a JSON data model to a user, you'll find that if your model was built correctly, your UI (and therefore your component structure) will map nicely. That's because UI and data models tend to adhere to the same *information architecture*. Separate your UI into components, where each component matches one piece of your data model.
4141

4242
![Component diagram](../images/blog/thinking-in-react-components.png)
4343

0 commit comments

Comments
 (0)