Skip to content

Instantly share code, notes, and snippets.

@whoisryosuke
Created July 10, 2018 00:00
Show Gist options
  • Save whoisryosuke/be4f5872df07be98f45c86c4dc73220f to your computer and use it in GitHub Desktop.
Save whoisryosuke/be4f5872df07be98f45c86c4dc73220f 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;
@talha-m-dev
Copy link

Thanks man. you just save my life... <3

@leticiamaiat
Copy link

thank you soo much!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment