Skip to content

Instantly share code, notes, and snippets.

View GeorgeCht's full-sized avatar
:electron:
Chilling

George Cht GeorgeCht

:electron:
Chilling
View GitHub Profile
@GeorgeCht
GeorgeCht / utils.tsx
Created January 6, 2025 12:54
SolidJS Utility Components in React
/**
* Renders a list of items from an array. If the array is empty, renders the
* `fallback` if provided.
*
* @param {Array<T>} each The array of items to render.
* @param {ReactNode} fallback An optional element to render if the array is empty.
* @param {(item: T, index: number) => U} children A function that takes an item and its index and returns a React element.
*
* @example
* ```tsx