Check out example codes for "mongo db returning null in array of string graphql". It will help you in understanding the concepts better.

Code Example 1

// Using the same query as aboveconst result = await client.query({ query: query });if (result.data.restaurants) {  result.data.restaurants.forEach(restaurant => {    if (restaurant) {      console.log(restaurant.name);      console.log(restaurant.location.address);    }  });}

Learn ReactJs, React Native from akashmittal.com