> ## Documentation Index
> Fetch the complete documentation index at: https://docs.towns.com/llms.txt
> Use this file to discover all available pages before exploring further.

# useSpace

Hook to get data about a space. You can use this hook to get space metadata and ids of channels in the space.

## Imports

```ts theme={null}
import { useSpace } from '@towns-protocol/react-sdk'
```

## Examples

You can use this hook to display the data about a space:

```tsx theme={null}
import { useSpace } from '@towns-protocol/react-sdk'

const Space = ({ spaceId }: { spaceId: string }) => {
    const { data: space } = useSpace(spaceId)
    return <div>{space.metadata?.name || 'Unnamed Space'}</div>
}
```

## Definition

```ts theme={null}
function useSpace(
  spaceId: string,
  config?: ObservableConfig.FromObservable<Space>,
): ObservableValue<SpaceModel>
```

**Source:** [useSpace](https://github.com/towns-protocol/towns/blob/main/packages/react-sdk/src/useSpace.ts)

## Parameters

### spaceId

* **Type:** `string`

The id of the space to get data about.

### config

* **Type:** `ObservableConfig.FromObservable<Space>`
* **Optional**

Configuration options for the observable.

## Return Type

The SpaceModel data.

```ts theme={null}
ObservableValue<SpaceModel>
```
