# useOptionalServices

Returns the services, or null outside a [`ServicesProvider`](https://docs.mapcairn.com/api/map/ServicesProvider.md). For the
few pieces, such as the live regions, that must still work when a test or
a host mounts them without one.

This is a function exported by `@mapcairn/map`, checked against version 0.2.0.

## Signature

```ts
import { useOptionalServices } from "@mapcairn/map";
 
function useOptionalServices(): Services | null;
```

## Returns

`Services | null`

## See also

- [`Services`](https://docs.mapcairn.com/api/core/Services.md)

Source: [packages/map/src/services/ServicesProvider.tsx:55](https://github.com/MapCairn/mapcairn/blob/main/packages/map/src/services/ServicesProvider.tsx#L55)
