Skip to content

Commit 3144485

Browse files
committed
Merge pull request #2635 from zpao/docs/props-state-clarification
[docs] Clarify when state may duplicate props
2 parents b3cd299 + 0a3a85b commit 3144485

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/docs/03-interactivity-and-dynamic-uis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ A common pattern is to create several stateless components that just render data
8383

8484
* **Computed data:** Don't worry about precomputing values based on state — it's easier to ensure that your UI is consistent if you do all computation within `render()`. For example, if you have an array of list items in state and you want to render the count as a string, simply render `this.state.listItems.length + ' list items'` in your `render()` method rather than storing it on state.
8585
* **React components:** Build them in `render()` based on underlying props and state.
86-
* **Duplicated data from props:** Try to use props as the source of truth where possible. Because props can change over time, it's appropriate to store props in state to be able to know its previous values.
86+
* **Duplicated data from props:** Try to use props as the source of truth where possible. One valid use to store props in state is to be able to know it's previous values, because props can change over time.

0 commit comments

Comments
 (0)