Hook that chunks an array into smaller arrays of a specified size.
The type of elements in the array.
The original array to be chunked.
The size of each chunk.
import { useChunked } from "@i-vresse/haddock3-ui/useChunked";const raw = [1, 2, 3, 4, 5, 6, 7, 8, 9];const chunkSize = 3;const chunks = useChunked(raw, chunkSize);// chunks = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] Copy
import { useChunked } from "@i-vresse/haddock3-ui/useChunked";const raw = [1, 2, 3, 4, 5, 6, 7, 8, 9];const chunkSize = 3;const chunks = useChunked(raw, chunkSize);// chunks = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Hook that chunks an array into smaller arrays of a specified size.