Created
October 9, 2017 23:41
-
-
Save Frithir/50da5315c56d23dee776af0051d856ba to your computer and use it in GitHub Desktop.
React Unsplashed random image loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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