Published on

JSX次数循环

Authors
  • avatar
    Name
    duluwa.com
    Twitter

方法 1

{[...new Array(3).keys()].map((_, index) => (
  <div>循环3次</div>
))}
//return [undefined, undefined, undefined]

方法 2

{[...new Array(10)].map((_, index) => (
  <div>循环10次</div>
))}
//return [0, 1, 2]