Skip to content

Instantly share code, notes, and snippets.

@Frithir
Created October 9, 2017 23:41
Show Gist options
  • Save Frithir/50da5315c56d23dee776af0051d856ba to your computer and use it in GitHub Desktop.
Save Frithir/50da5315c56d23dee776af0051d856ba to your computer and use it in GitHub Desktop.
React Unsplashed random image loop
import React from 'react'
import styled from 'styled-components'
const StyledImage = styled.img`
filter: grayscale(100%);
width: 100px;
height: 100px;
`
export default ({count = 10}) => {
const images = Array.from(Array(count))
.map((num, i) => `https://source.unsplash.com/10${i}x100`)
return (
<div>
{images.map(src => <StyledImage key={`image-${src}`} src={src} />)}
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment