# useBlockPageIdGetter

Source: https://sdk.pdf.net/docs/v1/reference/useBlockPageIdGetter



Returns a getter that resolves a block id to the id of the page holding the block, without subscribing the component to changes.

```ts
const getBlockPageId = useBlockPageIdGetter()

const pageId = getBlockPageId(blockId) // string | undefined
```

The getter returns `undefined` when the block is deleted or unknown: an id can go stale, so handle that case.

## Example [#example]

```tsx
import { useBlockPageIdGetter, useScrollToPage } from '@sdk-pdf/react'

function useScrollToBlockPage() {
  const getBlockPageId = useBlockPageIdGetter()
  const scrollToPage = useScrollToPage()

  return (blockId: string) => {
    const pageId = getBlockPageId(blockId)
    if (pageId) scrollToPage(pageId)
  }
}
```

