Skip to content

useListTransition

  • - 0
  • - 1
  • - 2
  • - 3
  • - 4

If you want to use view transition, the keyExtractor argument must be set.

API

useListTransition

function useListTransition<Item>(list: Array<Item>, options?: ListTransitionOptions<Item>): {
  transitionList: (renderCallback: ListRenderCallback<Item>) => JSX.Element[]
  isResolved: boolean
}

ListTransitionOptions

interface ListTransitionOptions<Item> {
  timeout: Timeout
  entered?: boolean
  keyExtractor?: (item: Item) => string | number
  viewTransition?: (fn: () => void) => void
}

ListRenderCallback

export type ListRenderCallback<Item> = (
  item: Item,
  stage: StatusState & { key: string | number }
) => React.ReactNode
 

StatusState

See useTransition#StatusState