createBackendForModule()
Home > @gooddata/sdk-ui-pluggable-application > createBackendForModule
createBackendForModule() function
This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Creates an analytical backend instance from the platform context auth credentials.
Signature:
export declare function createBackendForModule(auth: IAuthCredentials, options: ICreateBackendForModuleOptions): IAnalyticalBackend;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
auth | ||
|
options |
Returns:
Remarks
Each pluggable application module should create its own backend instance using this function rather than sharing the host's internal backend singleton. This ensures modules remain decoupled and avoids SDK version desync between independently built artifacts.
Example
import { createBackendForModule } from "@gooddata/sdk-ui-pluggable-application";
function MyApp({ ctx }: { ctx: IPlatformContext }) {
const backend = useMemo(
() => createBackendForModule(ctx.auth, { packageName: "my-module" }),
[ctx.auth],
);
// use backend...
}