0

How to update just one object value in react native state if we have thousands of objects in state. In my case its taking time to reflect and changing button after clicking as state is asynchronous process. How to update just single object inside an object not the whole array. Please help.

  • Welcome to StackOverflow! Have you tried anything so far? StackOverflow isn't a free code-writing service, and expects you to try to solve your own problem first. Please update your question to show what you have already tried, showing the specific problem you are facing in a [minimal, complete, and verifiable example](https://stackoverflow.com/help/minimal-reproducible-example). For further information, please see [how to ask](https://stackoverflow.com/help/how-to-ask) a good question, and take the [tour](https://stackoverflow.com/tour) of the site. – Sukhi Aug 09 '19 at 09:39

1 Answers1

0

you can save parent object in a variable then update what you want and then setState parent object.

Ex :

let parentState= this.state.parent;
    parentState.iWantUpdate= '';
    this.setState({parent: parentState});
Arash Younesi
  • 1,671
  • 1
  • 14
  • 23