If you are into SharePoint development, then you should be familiar with your best friend _spPageContextInfo, which gives you more valuable context-based information. In classic SharePoint Pages, you can access it directly like below:
  1. //This is how you access page context
  2. _spPageContextInfo.
  3. // retrieve site url
  4. _spPageContextInfo.webAbsoluteUrl
You can also access the same now from SharePoint Framework too.
  1. // This is how you can access the page context info
  2. this.context.pageContext.legacyPageContext;
  3. // Retreive current user display name
  4. this.context.pageContext.legacyPageContext[‘userDisplayName’]);
  5. // Even site classification
  6. this.context.pageContext.legacyPageContext[‘siteClassification’]);
Below is the complete list of object’s properties with sample values,
  1. CorrelationId : "b215479e-f056-5000-11a1-ec000000000010"
  2. DesignPackageId : "00000000-0000-0000-0000-000000000000"
  3. PreviewFeaturesEnabled: true
  4. PublishingFeatureOn : false
  5. ReycleBinItemCount : -1
  6. aadInstanceUrl : "https://login.windows.net"
  7. aadTenantId : "96d8e75d--14a031e2320f"
  8. aadUserId : "e7d71f70-13e9-0000-0000-86d1269cd536"
  9. alertsEnabled : true
  10. allowSilverlightPrompt : "True"
  11. blockDownloadsExperienceEnabled : false
  12. canUserCreateMicrosoftForm : true
  13. canUserCreateVisioDrawing : true
  14. cdnPrefix : "static.sharepointonline.com/bld"
  15. crossDomainPhotosEnabled : true
  16. currentCultureLCID : 1033
  17. currentCultureName : "en-US"
  18. currentLanguage : 1033
  19. currentUICultureName : "en-US"
  20. departmentId : null
  21. disableAppViews : false
  22. disableFlows : false
  23. env : "prod"
  24. farmLabel : "US_9_Content"
  25. fid : 16190
  26. formDigestTimeoutSeconds : 1800
  27. groupColor : "#188387"
  28. groupHasHomepage : true
  29. groupHasQuickLaunchConversationsLink : false
  30. groupId : "c771d35a-fee4-4447-9c0a-6c0b199d00fc"
  31. groupType : "Private"
  32. guestsEnabled : false
  33. hasManageWebPermissions : true
  34. hasPendingWebTemplateExtension : false
  35. hideSyncButtonOnODB : false
  36. hubSiteId : null
  37. idleSessionSignOutEnabled : false
  38. isAnonymousGuestUser : false
  39. isAppWeb : false
  40. isEmailAuthenticationGuestUser : false
  41. isExternalGuestUser : false
  42. isHubSite : false
  43. isMultiGeoTenant : false
  44. isNoScriptEnabled : true
  45. isSPO : true
  46. isSiteAdmin : true
  47. isTenantDevSite : false
  48. isWebWelcomePage : false
  49. layoutsUrl: "_layouts/15"
  50. listBaseTemplate : 100
  51. listId : "{7069a902-4347-000-8a03-00fceecfdc70}"
  52. listPermsMask : {High: 2147483647, Low: 4294705151}
  53. listTitle : "Property Locations"
  54. listUrl : "/sites/DemoModernTeamSite/Lists/Property Locations"
  55. maximumFileSize : 15360
  56. msGraphEndpointUrl : "graph.microsoft.com"
  57. navigationInfo : {quickLaunch: Array(14), topNav: Array(2)}
  58. nid : 107
  59. openInClient : false
  60. pageItemId : -1
  61. pageListId : "{7069a902-0000-4000-8a03-21fceecfdc70}"
  62. pagePermsMask : null
  63. pagePersonalizationScope : 1
  64. preferUserTimeZone : false
  65. readOnlyState : null
  66. serverRedirectedUrl : null
  67. serverRequestPath : "/sites/DemoModernTeamSite/Lists/Property Locations/AllItems.aspx"
  68. serverTime : "2018-02-04T04:58:48.0656761Z"
  69. showNGSCDialogForSyncOnODB : false
  70. howNGSCDialogForSyncOnTS : true
  71. siteAbsoluteUrl : "https://constoso.sharepoint.com/sites/DemoModernTeamSite"
  72. siteClassification : ""
  73. siteClientTag : "0$$16.0.7324.1203"
  74. siteColor : "#188387"
  75. siteId : "{1c2e6438-80d2-40cc-9bc5-5aa657c00000}"
  76. sitePagesEnabled : true
  77. siteServerRelativeUrl : "/sites/DemoModernTeamSite"
  78. siteSubscriptionId : "0f6d0000-f22c-47d7-a17f-cd78e6b74a54"
  79. supportPercentStorePath : true
  80. supportPoundStorePath : true
  81. systemUserKey : "i:0h.f|membership|[email protected]"
  82. tenantAppVersion : "3704586950"
  83. themeCacheToken : "/sites/DemoModernTeamSite:/sites/DemoModernTeamSite/_catalogs/theme/Themed/6FE0689A:9:16.0.7324.1203"
  84. themedCssFolderUrl : "/sites/DemoModernTeamSite/_catalogs/theme/Themed/6FE0689A"
  85. themedImageFileNames : {spcommon.png: "spcommon-B35BB0A9.themedpng?ctag=9",
  86. ellipsis.11x11x32.png: "ellipsis.11x11x32-2F01F47D.themedpng?ctag=9",
  87. O365BrandSuite.95x30x32.png: "O365BrandSuite.95x30x32-C212E2FD.themedpng?ctag=9",
  88. socialcommon.png: "socialcommon-6F3394A9.themedpng?ctag=9",
  89. spnav.png: "spnav-230C537D.themedpng?ctag=9", …}
  90. userDisplayName : "Rajesh Sitaraman"
  91. userEmail : "[email protected]"
  92. userFirstDayOfWeek : null
  93. userId : 3
  94. userLoginName : "[email protected]"
  95. userTime24 : false
  96. userTimeZoneData : null
  97. viewId : "{7edde8c2-5458-42b4-0000-883094b3837e}"
  98. viewOnlyExperienceEnabled : false
  99. webAbsoluteUrl : "https://contoso.sharepoint.com/sites/DemoModernTeamSite"
  100. webDescription : "Demo Modern Team Site"
  101. webFirstDayOfWeek : 0
  102. webId : "{8985f800-0000-42f2-899a-abb9f24251e3}"
  103. webLanguage : 1033
  104. webLogoUrl : "/sites/DemoModernTeamSite/_api/GroupService/GetGroupImage?
  105. id='8c1914df-0000-4088-a812-96183d42ae27'&hash=636533140690897999"
  106. webPermMasks : {High: 2147483647, Low: 4294705151}
  107. webServerRelativeUrl : "/sites/DemoModernTeamSite"
  108. webTemplate : "64"
  109. webTemplateConfiguration : "GROUP#0"
  110. webTime24 : false
  111. webTimeZoneData : {Description: "(UTC-08:00) Pacific Time (US and Canada)",
  112. Bias: 480, Id: 13, DaylightBias: -60, DaylightDate: {…}, …}
  113. webTitle : "Demo Modern TeamSite"
  114. webUIVersion : 15
Reference - https://rjesh.com/spPageContextInfo-spfx/