title: How to update an array inside an array of objects with useState function component
body: <p>How to update array inside array use state function component
  the array is inside the <code>setTask()</code> and how to use <code>setTask()</code> and add <code>new_photo</code> in photos</p>
  <pre><code>const new_photo = &quot;testing2.png&quot;; &lt;------------ insert this value in photos
  
  const [task, setTask] = useState([
      {
          task_id: 123,
          title: &quot;sample&quot;,
          photos: [&quot;testing1.png&quot;] &lt;------------ here
      }
  ])
  </code></pre>
  <p>Result should be like this:</p>
  <pre><code>[
      {
          task_id: 123,
          title: &quot;sample&quot;,
          photos: [&quot;testing1.png&quot;,&quot;testing2.png&quot;]
      }
  ]
  </code></pre>