I have some data that has the following shape. The schedule data also has other identifying information attached to it, being `schedules.included` which is an array of arrays. I want to loop through each included array and find it by `type` element. I'm not entirely sure how to get each `included[]` by type then update state with data from each array, respectively. Is `forEach` the correct approach?

```
const schedules = {
  data: [
    {
      id: "2147483610",
      type: "Schedule"
    }
  ],
  included: [
    {
      id: "21468486",
      type: "Query",
      name: "Query1"
    },
    {
      id: "43573457345",
      type: "DataSource",
      name: "DataSource1"
    }
  ]
};

```

I then want to update state with whatever data I need.

```
      getData = () => {
        axios({
          method: "get",
          url: `/endpoint/with/this/data`
        })
          .then(response => {
            console.log(response);
            var obj = schedules.included[i].type;
            obj.forEach(function(type) {
            alert(type.name);
            });
            this.setState({
              schedules: schedules.data,
              //update with name from type Query
            });
          })
          .catch(error => console.log(error.response));
      };

```