import React from 'react'; import ReactDOM from 'react-dom'; import styled from 'styled-components'; import { PhotoProvider, PhotoConsumer } from '../src'; const Container = styled.div` font-size: 32px; `; const ImageList = styled.div` padding: 40px; display: flex; flex-wrap: wrap; align-items: center; `; const SmallImage = styled.img` margin-right: 20px; margin-bottom: 20px; width: 100px; height: 100px; cursor: pointer; `; class Example extends React.Component { state = { photoImages: ['1.png', '2.jpg', '3.jpg', '4.jpg', '5.jpg'], }; render() { const { photoImages } = this.state; return ( {photoImages.map((item, index) => ( {index < 2 ? : undefined} ))} ); } } ReactDOM.render(, document.getElementById('__react-content'));