useApp

useApp<T>(appId: string, options?:WebAppOptions, deps?: any[]) : T | null | undefined;

Returns an app details for the given Id.

Examples

Get app from site collections app catalog,

const app = useApp("5ee53613-bc0f-4b2a-9904-b21afd8431a7");

Query app propeties,

const appWithQuery = useApp("5ee53613-bc0f-4b2a-9904-b21afd8431a7", {
  query: {
    select: ["Title", "Id", "IsEnabled"]
  }
});

Get app from tenant app catalog,

const tenantApp = useApp("5ee53613-bc0f-4b2a-9904-b21afd8431a7", {
  scope: "tenant"
});

Set scope to site collection explicitly, same as setting scope to undefined,

const tenantApp = useApp("5ee53613-bc0f-4b2a-9904-b21afd8431a7", {
  scope: "sitecollection"
});

Parameters

NameTypeDescriptionTracked for changes
appIdstringApp UUID string.Yes
options?WebAppOptionsuseApp hook optionsPartially
deps?DependencyListHook dependency list.Yes