Skip to content

cheton/react-foreach

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-foreach build status Coverage Status

NPM

A React component that renders each element of collection using a function as child component.

Installation

npm install --save react react-foreach

Usage

You can use lodash's uniqueId() to return unique keys for array children.

<ForEach items={[1, 2, 3, 4, 5]}>
{(value, index, array) => (
    <React.Fragment key={_uniqueId()}>
        <ListItem>{value}</ListItem>
    </React.Fragment>
)}
</ForEach>

API

Properties

Name Type Default Description
items array A list of items to render.

License

MIT

About

A React component that renders each element of collection using a function as child component.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published