94 Gists代码片段收录
1 React
React
直接在Dom
中遍历生成节点
let App = () => {
return <ul>{Array.from(Array(10), (e, i) => {
return <li key={i}>{i}</li>
})}</ul>
}
ReactDOM.render(
<App />,
document.getElementById('app')
);
摘录自How to loop over a number in React inside JSX - stackOverflow