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

Document how to update nested state properties #1101

Open
dandv opened this issue Jul 30, 2018 · 3 comments
Open

Document how to update nested state properties #1101

dandv opened this issue Jul 30, 2018 · 3 comments

Comments

@dandv
Copy link
Contributor

@dandv dandv commented Jul 30, 2018

In setState, what should one return from the updater function in order to update a nested property of the state? This isn't documented, and it trips a lot of people:

https://stackoverflow.com/questions/18933985/this-setstate-isnt-merging-states-as-i-would-expect
https://stackoverflow.com/questions/43040721/how-to-update-a-nested-state-in-react
https://stackoverflow.com/questions/34071160/how-to-update-object-in-react-js
etc.

@zacharymorel
Copy link

@zacharymorel zacharymorel commented Jan 22, 2019

I second this, I would love to read some detailed docs from y'all.

@yvesgurcan
Copy link

@yvesgurcan yvesgurcan commented Jun 29, 2019

Hey guys! I opened a PR to document how to handle nested state properties. First contribution to the ReactJS.org project :)

geetesh911 added a commit to geetesh911/reactjs.org that referenced this issue Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.