# useDirections

The state of one set of directions: the stops, the travel mode and the
route or travel-time area the service found for them, with the requests
cancellable and nothing stored. A request is sent only when the person asks
(`requestRoute`, `requestArea`, `retry`), never as stops change.

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

## Signature

```ts
import { useDirections } from "@mapcairn/map";
 
function useDirections(units: UnitSystem): UseDirections;
```

## Parameters

- `units` (`UnitSystem`): The unit system for the announcements.

## Returns

`UseDirections`

## Remarks

A result belongs to the stops and mode it was found for, so
 changing either goes back to idle: a line that no longer matches the
 stops is never left on the map. One request runs at a time; a newer one
 replaces it, and the answer to a replaced or cancelled request is ignored.
 Outcomes are announced through the app-wide announcer, errors assertively.
 Any failure the service does not describe is a `network` failure.

## See also

- [`UnitSystem`](https://docs.mapcairn.com/api/core/UnitSystem.md)
- [`UseDirections`](https://docs.mapcairn.com/api/map/UseDirections-interface.md)

Source: [packages/map/src/tools/Directions/useDirections.ts:199](https://github.com/MapCairn/mapcairn/blob/main/packages/map/src/tools/Directions/useDirections.ts#L199)
