# hooks/useLatest (zidane-ui)

Import: `import { … } from 'zidane-ui'`. Source: [ui/src/hooks/useLatest.ts](https://github.com/Tahul/zidane/blob/main/ui/src/hooks/useLatest.ts).

## Functions

### `useLatest`

Function.

A stable function returning `value` as of the last commit, for what is built once (a store, a palette
source, a listener) and reads the current value when it runs. Never call it during render.

```ts
function useLatest<T>(value: T): () => T
```

**Type parameters**

- `T`

**Parameters**

- `value` (`T`): What the function returns.

**Returns** `() => T`: The same function for the component's life.

Source: [ui/src/hooks/useLatest.ts:10](https://github.com/Tahul/zidane/blob/main/ui/src/hooks/useLatest.ts#L10)
