在react中使用map函数
1
2
3
4
5
6
7
8
9const numbers = [1, 2, 3, 4, 5];
const listItems = numbers.map((numbers) =>
<li>{numbers}</li>
);
ReactDOM.render(
<ul>{listItems}</ul>,
document.getElementById('example')
);
React tips
- Post link: https://goldminerxun.github.io/2019/08/13/React%20Tips/
- Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 3.0 unless stating additionally.