Skip to content

[Docs] - Confusing explanation about what shouldn’t go in state #1883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hnordt opened this issue Jul 19, 2014 · 2 comments · Fixed by #2635
Closed

[Docs] - Confusing explanation about what shouldn’t go in state #1883

hnordt opened this issue Jul 19, 2014 · 2 comments · Fixed by #2635

Comments

@hnordt
Copy link
Contributor

hnordt commented Jul 19, 2014

http://facebook.github.io/react/docs/interactivity-and-dynamic-uis.html

At the end, there is a confusing explanation about "Duplicated data from props" in the section "What Shouldn’t Go in State?":

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.

Perhaps what is trying to be said is something like:

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.

@syranide
Copy link
Contributor

it's appropriate to store props in state to be able to know its previous values.

Ah, perhaps what they're really referring to is basically "edit pages", where you might want to diff the before and after, so that you can send only the changed variables. But it really reads quite weirdly, especially for beginners.

@lostpebble
Copy link

This change is needed. I'm new to React and just did a Google search on that part of the documentation for clarification and it came up with this page. I'm guessing that what you've interpreted it to mean is correct, as it makes sense that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants