I have used the group and content relationship fields to create an array of documents for a specific type. The plan is to create a "featured work" section on a page.
Currently the data retuned gives me an array with access to the following for each "work" document types:
The data returns the UID which I know I can use to get the data on a page, but as this is data being fetched from a component level and there would be multiple UIDs, I am not sure of the best approach to get access to all data items like titles, images etc for each selected work documents to then loop over and pass into a card component to display.
For reference the build consists of NextJS, React/TypeScript.
Any pointers anyone can give for the best approach to achieve this would be appreciated.
@luke1, we recently solved his problem for our use case with the graphQuery option. FetchLinks does not return all of the nested fields in our custom types.
This query using fetchLinks did not return all of the fields:
getFeaturedWork returns an array of IDs set by the user in the CMS using a mixture of group/content relationship fields. The array of IDs then pulls all relevant data from the individual documents with getAllByIDs.