Skip to content

useCycle

This hook allows you to iterate all the elements of a given array cyclically.

{
array: T[],
delay?: number // By default 500
}

The useCycle hook returns the corresponding element of the array of the cycle:

import { useCycle } from '@tecnosamba21/sam-hooks'
export function Cycle() {
const cycle = useCycle<string>(['🗂️', '🪟', '👋', '📦'], 500)
return <h1>{cycle}</h1>
}