1.0.1 • Published 2 years ago

@jfdi/react-utils-for v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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"));