How to use Graphql with Strapi4

System Information

4.1.0- Strapi Version:

Hi,

I’m using queries like below

query GetLessons {
  lessons {
		data {
      attributes {
        heading
        content
      }
    }
  }
}

I’ve noticed the query is wrapped in additional ‘data’ and ‘attributes’ values, which is not what I’m used to seeing with graphql queries. The data returned is an object->object->array of lessons

So I can’t use data.lessons.map() like I want to. How am I supposed to iterate through the data array if I can’t get to it?

Thanks.


It’s been a huge discussion for the v4

Personally I’m not a huge fan of this new format, but you have no choices but using it in the v4.
It’s annoying, but you’ll get use to it.

Not a graphql user but even in other use cases like in your front it becomes a lot more bloated than before, it’s a shame imo

It seems to be the same for REST as well.