How to populate the dropdown with list names

Iron Contributor


 am trying to create a dropdown in the property panel of a webpart with SPFx and I found this tutorial: 

Use cascading dropdowns in web part properties


The problem with the sample is that is is using static data and I would like to know how to fetch the list names dynamically.


How can I do that? 


Best  regards


1 Reply
Hi @America
You can load all lists from current site or specific site collection by calling SharePoint REST API using SPHttpClient class of SPFx or you can use fluent APIs of @PnP which is great wrapper around SharePoint APIs.

You can more details about SPHtppClient class here