Syntactic sugar for using loops in React with optional no-data message
npm install react-for-loop> Syntactic sugar for using loops in React with optional no-data message
 
``bash`
npm install --save react-for-loop
`jsx
import React, { useState } from "react";
import { For } from "react-for-loop";
export default () => {
const [data, setData] = useState([]);
const handleClick = action => {
if (action === "add") {
setData([...data, data.length]);
}
if (action === "remove") {
data.pop();
setData([...data]);
}
};
return (
MIT © sumedh22