---
title: useIntentQueue
description: "Buffers unique input intents between ticks."
---

```tsx
import { useIntentQueue } from 'filedom';

const intents = useIntentQueue<'left' | 'right'>();

const handleLeft = () => intents.push('left');
const readTickInput = () => intents.drain();
```

The queue is a `Set`, so repeated identical intents collapse into one. Pushing and draining do not cause renders. A typical game pushes intents from key handlers and drains them in a [useFixedTick](/docs/reference/hooks/use-fixed-tick) callback.

## Returns

- `push(intent)`: adds an intent.
- `drain()`: returns the queued intents as a `Set<T>` and clears the queue.
- `clear()`: empties the queue.
