useQueue

Show a limited number of items at once and keep the rest waiting in a queue.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

Only two items are visible, the others wait in the queue.

APIs

useQueue

const useQueue = <T>(options?: {
  initialValues?: T[]
  limit?: number
}) => {
  state: T[]
  queue: T[]
  add: (...items: T[]) => void
  update: (fn: (items: T[]) => T[]) => void
  cleanQueue: () => void
}
Edit this page on GitHub