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

# useBackendWithCorrelation()

- 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/CorrelationContext.tsx

Hook to get a backend instance with correlation metadata from context, and optionally merge them with additional correlation metadata provided as a parameter.

**Signature:**

```typescript
useBackendWithCorrelation: (backend?: IAnalyticalBackend, correlationMetadata?: IRequestCorrelationMetadata) => IAnalyticalBackend | undefined
```

## 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)_ optional backend override |
| correlationMetadata | [IRequestCorrelationMetadata](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.irequestcorrelationmetadata/index.md) | _(Optional)_ optional correlation metadata to merge with the context data |

**Returns:**

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

## Remarks

This hook enhances the backend from useBackend() with correlation metadata from the nearest CorrelationProvider.
