reactjs

Loop n times in React

Array.apply(null, { length: 20 }).map((e, i) => (
  <span className="busterCards" key={i}>
    {e}
  </span>
));

If you want to iterate n times using map in the React template you can use this code snippet. Here we have applied a length of 20 to the array so it will iterate 20 times.

Was this helpful?