Use GraphQL endpoint to fetch data and display in an AEM component
Consider a content fragment that refers another content fragment (nested content fragment).
I have setup a GraphQL endpoint to fetch this content fragment along with its nested content. This endpoint is consumed by an external react application which retrieves and displays the data.
Now, I need to display the same information in an AEM component. Would it be better to call the GraphQL endpoint within the AEM component, or is the traditional way of retrieving content fragments better?
Additionally, if I do want to call the GraphQL endpoint from within an AEM component, what's the best way of doing it? Is it recommended to use Sling models for this purpose?