useBackendStrict
Home > @gooddata/sdk-ui > useBackendStrict
useBackendStrict variable
Hook to get analytical backend instance provided to BackendProvider.
Signature:
useBackendStrict: (backend?: IAnalyticalBackend, context?: string) => IAnalyticalBackend
Remarks
You can set a backend override that will be returned if defined. This makes the usage more ergonomic (see the following example).
Note: If you do not provide an IAnalyticalBackend instance to BackendProvider or as a parameter for this hook, an invariant error is raised.
Example
// instead of
const fromContext = useBackendStrict();
const effectiveBackend = fromArguments ?? fromContext.
// you can write
const backend = useBackendStrict(fromArguments);