title: Updating a nested state Object in React Native?
body: <p>I am creating a shopping list application that gives a user to ability to create a shopping list.  Each shopping list that the user creates has the following properties:</p>
  <p>key
  name
  budget
  listItem</p>
  <p>Nested within the listItem property is an array of objects of list items.</p>
  <p>Each list item has the following properties:
  id:
  name:
  price:</p>
  <p>Here is a code snippet:</p>
  <pre><code>const [shoppingLists, setShoppingList] = useState([
      {key: '1', name: `Khari's Shopping List`, budget: 200, listItems:[
              {id: Math.random().toString(), name:&quot;butter&quot;, price:2.00},
              {id: Math.random().toString(), name:&quot;milk&quot;, price:2.00},
              {id: Math.random().toString(),  name:&quot;cereal&quot;, price: 3.00},
              {id: Math.random().toString(),  name:&quot;chicken&quot;, price: 4.00},
              {id: Math.random().toString(),  name:&quot;spaghetti&quot;, price: 5.00},
          ], },
      {key: '2', name: `Janae's Shopping List`, budget: 500, listItems:[
              {id: Math.random().toString(), name:&quot;butter2&quot;, price:0.00},
              {id: Math.random().toString(), name:&quot;milk2&quot;, price:0.00},
              {id: Math.random().toString(),  name:&quot;cereal3&quot;, price: 0.00},
              {id: Math.random().toString(),  name:&quot;chicken2&quot;, price: 0.00},
              {id: Math.random().toString(),  name:&quot;spaghetti2&quot;, price: 0.00},
          ], },
  
  ])
  </code></pre>
  <p>What I wish to do is update the price property that is nested in the list item when a user enters a number in the text input. Any ideas on how I can achieve this ?</p>
  <p>When a user enters a number in a text input I what to update the price property in the list item array based on the id. I am not sure where to begin and I am hoping for some guidance.  Thanks for any help that you can offer.</p>