> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# useBackendStrict()

- Package: [@gooddata/sdk-ui](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui/index.md)
- Kind: function
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-ui/src/base/react/BackendContext.tsx
- Guides: [useBackend](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/hooks/use-backend/index.md)

Hook to get analytical backend instance provided to [BackendProvider()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui/sdk-ui.backendprovider/index.md).

**Signature:**

```typescript
useBackendStrict: (backend?: IAnalyticalBackend, context?: string) => IAnalyticalBackend
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| backend | [IAnalyticalBackend](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md) | _(Optional)_ backend to use instead of context value. If undefined, the context value is used. |
| context | string | _(Optional)_ provide context to improve error message in raised invariant (e.g. parent hook name). |

**Returns:**

[IAnalyticalBackend](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md)

## 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](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.ianalyticalbackend/index.md) instance to [BackendProvider()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui/sdk-ui.backendprovider/index.md) or as a parameter for this hook, an invariant error is raised.

## Example

```tsx
// instead of
const fromContext = useBackendStrict();
const effectiveBackend = fromArguments ?? fromContext.
// you can write
const backend = useBackendStrict(fromArguments);
```
