Fetch layout data with the JSS GraphQL Layout Service
Version:
You can fetch layout data from Sitecore using GraphQL and the JSS GraphQLLayoutService class.
To fetch layout data with the JSS GraphQL Layout Service:
-
In a
layout-service.tsfile, create and configure an instance of theGraphQLLayoutServiceclass using : -
In the file where you want to fetch the data, import and use your new layout service instance:
Tip
You can pass a formatLayoutQuery option to your GraphQLLayoutService instance to override the default query. See the GraphQLLayoutServiceConfig type for details.