import React from 'react'; export default class Gallery extends React.Component { onPrevClick (e) { this.props.dispatch({type: 'PREV_IMAGE'}); } onNextClick (e) { this.props.dispatch({type: 'NEXT_IMAGE'}); } onImageDotClick (index, e) { this.props.dispatch({type: 'VIEW_IMAGE', action: {index}}) } render() { const {images, imageIndex} = this.props; if (!images || images.length === 0) { return null; } const showPrev = imageIndex > 0; const showNext = imageIndex < images.length - 1; return (