Beginnerprogrammer Beginnerprogrammer - 1 year ago 59
Javascript Question

How to skip first in map function

I want to skip the first in the

function what I do now is this:

return (
<div className="gallery clearfix">
<div className="gallery-image">
<img src={[0].images.thumbnail_sm} alt={block.title} srcSet={`${[0].images.thumbnail_md} 1x, ${[0].images.thumbnail_lg} 2x`} className="img-fluid" />
<div className="gallery-thumbs">
<div className="row">
{, i) => (
<div className="gallery-item" key={i}>
{ > 4 ?
<div className="inner">
<img src={[i].images.thumbnail_sm} alt={block.title} srcSet={`${[i].images.thumbnail_md} 1x, ${[i].images.thumbnail_lg} 2x`} className="img-fluid" title="" />
<div className="img-overlay">
<span className="img-overlay-body">{ - 4 }+ <span className="hidden-xs">Foto's</span></span>
<img src="" alt="" className="img-fluid" title="" />

as you see I show the first pic in the first
tag but it will also show in the
function as first so I got duplicated images. How do I skip the first image in the

Answer Source

So slice it to skip the first

You also need to reference the item passed into map, not using the index with the orginal array.[i].images.thumbnail_sm

should be

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download