Skip to content

Instantly share code, notes, and snippets.

@Uvacoder
Forked from whoisryosuke/limit-map-loop.js
Created October 18, 2022 16:06
Show Gist options
  • Select an option

  • Save Uvacoder/0841f26547376a453ba55040c0e40672 to your computer and use it in GitHub Desktop.

Select an option

Save Uvacoder/0841f26547376a453ba55040c0e40672 to your computer and use it in GitHub Desktop.
Javascript - Limit a `.map()` loop to a certain number using `.slice()`- via: https://stackoverflow.com/questions/42374873/limit-items-in-a-map-loop
var film = this.props.data.slice(0, 5).map((item) => {
return <FilmItem key={item.id} film={item} />
});
return film;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment