Requesting and retrieving data from a 3rd party API (Facebook Graph API) by encapsulating the request within its own component.
main
create an instance of the data retrieving component, fbRetrieveData
and asynchronously calls a retrieve
function.retrieve
function within the fbRetrieveData
then gets the data, manipulates it as necessary and returns it back to the main
component.main
component then displays the data.I've found articles on how to do this, such as this one, but they all seem to require that some layout is returned and/or that the retrieving component is called by being part of the layout.
Any help would be hugely appreciated!
In case anyone comes across this, I have decided to just use a JavaScript class instead to avoid having to return null as previously proposed.