# useEntity

**Category:** Base Components/Pages/Entity Page/Hooks/useEntity

## API

### Overview

A React hook that subscribes to the entity from [`EntityPageState`](./?path=/story/base-components-pages-entity-page-state--entitypagestate) and returns it reactively. Use this when you need to access the entity outside of `Card.Content`, such as in the page header (title, subtitle, breadcrumbs, etc.).

**Important:** During the first render the entity will be `undefined` while data is being fetched. Do not rely on the initial value — always handle the `undefined` case.

```tsx
import { useEntity } from '@wix/patterns';
```

### Signature

```tsx
const entity = useEntity(state);
// entity: T | undefined
```

### Example

```tsx
function MyEntityPage({ state }) {
  const entity = useEntity(state);

  return (
    
      
      
        {/* Card.Content receives the entity automatically */}
      
    
  );
}
```

### Returns

Returns [`EntityPageState`](./?path=/story/base-components-pages-entity-page-state--entitypagestate)`.entity` — the current entity value (`T | undefined`).

