For

For is a declarative component that unifies list rendering and empty-state handling. While React developers commonly use Array.map(), handling empty or null data often requires extra conditionals. For consolidates iteration and fallback behavior into a single, readable construct.

Basic usage#

Render list items declaratively and provide a fallback to display when the array is empty, null, or undefined.

DOM-preserving variants#

Variants such as For.ui or For.div let you keep the outer DOM node present while swapping inner content, preserving layout and avoiding CSS reflow issues when the list changes.

Forrable#

Forrable is a special component used inside For that is useful for mixing static content with dynamic lists. While For.ul always renders, only the Forrable inside it repeats for each item in the array. This allows you to maintain fixed elements like headers or footers while repeating only specific parts.

Components - Control Flow Utilities | ilokesto - React Library Collection