Hi @lee sharepoint ,
If you are new to SPFx and started learning it, my suggestion is to use the PnP JS, the more convenient way to work with SharePoint list, libraries, user profile, taxonomy etc..
private GetLists():Promise<any>{
return sp.web.lists.filter(‘Hidden eq false’).get().then((data) =>{
console.log(“Total number of
lists are “ + data.length);
return data;
});
Below are the few links for your reference :
- https://pnp.github.io/pnpjs/getting-started/
- https://iamguptarishi.wordpress.com/2018/10/26/read-all-lists-views-fields-using-pnpjs-in-spfx-webpart/
- https://www.c-sharpcorner.com/article/sharepoint-framework-crud-operations-using-sp-pnp-js/
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.