Skip to content
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

Update state-and-lifecycle.md #9562

Closed
wants to merge 1 commit into from

Conversation

steadycoding
Copy link

@steadycoding steadycoding commented Apr 30, 2017

While reading the documentation it seemed to me that the documentation could be improved for beginners by a short example on how to update child properties of state and a link to further reading.

While reading the documentation it seemed to me that the documentation could be improved for beginners by a short example on how to update child properties of state and a link to further reading.
Copy link
Contributor

@aweary aweary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to do this @steadycoding.

I don't think we should introduce immutability-helper here, it will likely only serve to confuse beginners who aren't familiar with its syntax.

Though I agree that it's useful to briefly mention how to updated nested properties. It might be better to mention this in the section on not mutating state. We could even link to this section on not mutating data.

The only place where you can assign this.state is the constructor. If you need to update nested properties make sure you do so without mutating this.state. See The Power Of Not Mutating Data for more on that.

@bvaughn
Copy link
Contributor

bvaughn commented Oct 6, 2017

Thank you for submitting this PR! 😄

Unfortunately the documentation and source code for reactjs.org has been moved to a different repository: https://github.com/reactjs/reactjs.org

If you are willing, please open a new PR there. Sorry for the inconvenience!

(For more backstory on why we moved to a new repo, see issue #11075)

@bvaughn bvaughn closed this Oct 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants