Skip to Content

createFixedArray

Exports Size
loading...
Gzip Size
loading...
Brotli Size
Source Code
View on GitHub
Docs
Edit this page

Create shared fixed-size read-only arrays.

Usage

Below is an example of creating a loading skeleton screen with 10 skeleton items:

import { memo } from 'react'; import { createFixedArray } from 'foxact/create-fixed-array'; const PostsLoading = () => { return ( <Stack> {createFixedArray(10).map(i => ( <Skeleton key={i} h={48} w="100%" /> ))} </Stack> ); }; export default memo(PostsLoading);