how to use for in react code example
Example 1: react for
render() {
const elements = ['one', 'two', 'three'];
const items = []
for (const [index, value] of elements.entries()) {
items.push(<li key={index}>{value}</li>)
}
return (
<div>
{items}
</div>
)
}
Example 2: react quick tutorial
ReactDOM.render(
<Hello />,
document.getElementById("root")
);