This video walk through the each steps to use PnP JavaScript library to get web details in a SharePoint Framework webpart.
pnp.sp.site.getWebUrlFromPageUrl ( <Absolute path of website> ) Trim the absolute URL of the page and return the web URL. <Absolute path of website> Represents the absolute path of a Website under the current Site Collection Example The steps and code snippet given below, are ...
//The below PnP property used to return the root website of the site collection $pnp.sp.site.rootWeb.get().then(function(web) { document.getElementById("sample").innerText = "Title: " + web.Title + "\r\n" + "Description: " + web.Description; }).catch(function(err) { al...