# useSelection

The selected set, or undefined outside a [`SelectionProvider`](https://docs.mapcairn.com/api/map/SelectionProvider.md) or when
the host offers no selection. A component that selects or lists features
renders nothing then.

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

## Signature

```ts
import { useSelection } from "@mapcairn/map";
 
function useSelection(): FeatureSelectionState | undefined;
```

## Returns

`FeatureSelectionState | undefined`

## See also

- [`FeatureSelectionState`](https://docs.mapcairn.com/api/map/FeatureSelectionState.md)

Source: [packages/map/src/layers/SelectionProvider.tsx:40](https://github.com/MapCairn/mapcairn/blob/main/packages/map/src/layers/SelectionProvider.tsx#L40)
