---
url: https://lit-ui-router.dev/api/lit-ui-router-effect/functions/routeRef.md
---
[lit-ui-router-effect](../index.md) / routeRef

# Function: routeRef()

```ts
function routeRef(router): SubscriptionRef<RouteSnapshot>;
```

Defined in: ui-router-effect/dist/route-ref.d.ts:13

The route ref for a router — one per router instance, attached lazily.

No plugin and no router-configuration wiring: the first caller creates the
ref and registers the single `onSuccess` hook that feeds it, and both live
as long as the router does. `onSuccess` is the only hook a later transition
cannot supersede, so every value the ref ever holds is a settled route.
Its snapshot is typed by `RouteTypes` when a registry fills it in.

## Parameters

| Parameter | Type |
| ------ | ------ |
| `router` | [`UIRouter`](https://ui-router.github.io/core/docs/latest/classes/_router_.uirouter.html) |

## Returns

[`SubscriptionRef`](https://effect.website/docs/state-management/subscriptionref/)<[`RouteSnapshot`](../interfaces/RouteSnapshot.md)>
