Can someone explain to me this:
private _getMockListData(): Promise<ISPLists> {
return MockHttpClient.get()
.then((data: ISPList[]) => {
var listData: ISPLists = { value: data };
return listData;
}) as Promise<ISPLists>;
}
I'm copying directly from the MS tutorial on spfx development. Can someone guide me line by line on what it's doing. To give more context I have a separate mock SP list file which is exported from the main entry file (.ts) called ISPList. The above code is typed directly into the entry file.
Up to this point I've understood most of the tutorial but this code is confusing as I get what a Promise is meant to do but need clarification on how this one is written.
Also is the .then a simplification of a If - Then and the return is an alternative to an If - Then? Here is the tutorial if you need it:https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/connect-to-sharepoint Apo