@jfdi/react-utils-for
v1.0.1
Published
For is what loops should always have been in React.
Downloads
1
Keywords
Readme
For
For is what loops should always have been in React.
Install
npm install --save @jfdi/react-utils-for
Example
import React, { useState } from "react";
import ReactDOM from "react-dom";
import { For } from "@jfdi/react-utils-for";
const App = () => {
const testItems = [{text: "test1"},{text: "test2"}];
return (
<For each={testItems}>{(item, index) => (
<div key={`${item.text}${index}`}>{item.text}</div>
)}</For>
);
};
ReactDOM.render(<App />, document.getElementById("root"));