@jfdi/react-utils-for
v1.0.1
Published
For is what loops should always have been in React.
Downloads
15
Keywords
Readme
For
For is what loops should always have been in React.
Install
npm install --save @jfdi/react-utils-forExample
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"));