You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/basics/UsageWithReact.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -14,18 +14,18 @@ We will use React to build our simple todo app.
14
14
npm install --save react-redux
15
15
```
16
16
17
-
## Smart and Dumb Components
17
+
## Container and Presentational Components
18
18
19
-
React bindings for Redux embrace the idea of [separating “smart” and “dumb” components](https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0).
19
+
React bindings for Redux embrace the idea of [separating container and presentational components](https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0).
20
20
21
-
It is advisable that only top-level components of your app (such as route handlers) are aware of Redux. Components below them should be “dumb” and receive all data via props.
21
+
It is advisable that only top-level components of your app (such as route handlers) are aware of Redux. Components below them should be presentational and receive all data via props.
@@ -52,7 +52,7 @@ It is advisable that only top-level components of your app (such as route handle
52
52
</tbody>
53
53
</table>
54
54
55
-
In this todo app, we will only have a single “smart” component at the top of our view hierarchy. In more complex apps, you might have several of them. While you may nest “smart” components, we suggest that you pass props down whenever possible.
55
+
In this todo app, we will only have a single container component at the top of our view hierarchy. In more complex apps, you might have several of them. While you may nest container components, we suggest that you pass props down whenever possible.
56
56
57
57
## Designing Component Hierarchy
58
58
@@ -75,13 +75,13 @@ I see the following components (and their props) emerge from this brief:
75
75
-`filter: string` is the current filter: `'SHOW_ALL'`, `'SHOW_COMPLETED'` or `'SHOW_ACTIVE'`.
76
76
-`onFilterChange(nextFilter: string)`: Callback to invoke when user chooses a different filter.
77
77
78
-
These are all “dumb” components. They don’t know *where* the data comes from, or *how* to change it. They only render what’s given to them.
78
+
These are all presentational components. They don’t know *where* the data comes from, or *how* to change it. They only render what’s given to them.
79
79
80
80
If you migrate from Redux to something else, you’ll be able to keep all these components exactly the same. They have no dependency on Redux.
81
81
82
82
Let’s write them! We don’t need to think about binding to Redux yet. You can just give them fake data while you experiment until they render correctly.
83
83
84
-
## Dumb Components
84
+
## Presentational Components
85
85
86
86
These are all normal React components, so we won’t stop to examine them in detail. Here they go:
This is much less typing! If you’d like, you can still have “vanilla” action creators like `loadPostsSuccess` which you’d use from a “smart”`loadPosts` action creator.
326
+
This is much less typing! If you’d like, you can still have “vanilla” action creators like `loadPostsSuccess` which you’d use from a container`loadPosts` action creator.
327
327
328
328
**Finally, you can write your own middleware.** Let’s say you want to generalize the pattern above and describe your async action creators like this instead:
0 commit comments