How to Loop inside React JSX

Spread the love

In this tutorial you will learn about how to Loop inside React JSX

#sample program  -1

const rows = [];
for (let i = 0; i < numrows; i++) {
rows.push();
}
return (<div>{rows}</div>);

#sample program – 2

return (
<>
<div>
{List.length > 0 &&
List.map((item, idx) => {
<h3>
{item.feature.name}
</h3>
})}
</div>
<>

Ref : https://reactjs.org/docs/lists-and-keys.html

admin

admin

Leave a Reply

Your email address will not be published. Required fields are marked *