---
url: >-
  https://lit-ui-router.dev/reference/lit-ui-router-ssr/client/variables/adoptUiViewContext.md
---
[lit-ui-router-ssr](../../index.md) / [client](../index.md) / adoptUiViewContext

# Variable: adoptUiViewContext

```ts
const adoptUiViewContext: AdoptUiViewContext;
```

Defined in: [packages/lit-ui-router-ssr/src/adopt-context.ts:64](https://github.com/simshanith/lit-ui-router/blob/6e47ef8d8a4b24e99c074fb5c8c9cfaddfdb36a4/packages/lit-ui-router-ssr/src/adopt-context.ts#L64)

The context key a hydration client answers for, under the container it
hydrates, with the function that adopts a waking `<ui-view>`'s held nodes.

The view requests it once on its waking update, after re-seeking its router,
and calls what it gets. Unanswered, the view drops the held nodes and warns.

[hydrateRoot](../functions/hydrateRoot.md) provides it with core's `provideContext()`; an element
provides it with `@provide` from `@lit/context`, since the key is the one
`createContext()` would have produced.

## Example

```ts
import { provideContext } from 'lit-ui-router/context';
import {
  adoptUiViewContext,
  type AdoptableView,
} from 'lit-ui-router-ssr/client';

declare const container: HTMLElement;
declare function adopt(view: AdoptableView): void;

const uninstall = provideContext(container, adoptUiViewContext, (view) =>
  adopt(view),
);
```
