So, I have a a state of users which gets filled up with an array of Objects from the backend. Say, I want to update the details of a specific User Object from that array and then update the current state with the updated details. How do I go about doing that?
What I currently do is force a refetch from the server once the update request is successful to update the state again but I was wondering if there's a better way to do it without refetching from the server again.
For example, on the code below. I wanted to update PersonTwo's age.
state = {
  users: [
    {
      name: PersonOne,
      age: 1
    },
    {
      name: PersonTwo,
      age: 1
    }
  ]
}
 
     
     
    