JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<div id="root"></div>

Babel + JSX

class App extends React.Component {
  state = {
    image: 0,
  }

  next = ({ target: { dataset: { step } } }) => {
    const len = this.props.items.length;
    this.setState({
      image: (this.state.image + +step + len) % len,
    });
  }

  render() {
    return (
      <div>
        <div>
          <button onClick={this.next} data-step="-1">Prev</button>
          <button onClick={this.next} data-step="+1">Next</button>
        </div>
        <img src={this.props.items[this.state.image].img} />
      </div>
    );
  }
}

const items = [
    { img: "https://pbs.twimg.com/profile_images/3117087049/697e0334a13361c6ab68ce00aefefa4f.jpeg" },
    { img: "http://vkclub.su/_data/gifts/134.jpg" },
    { img: "https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTBIqdLHvhxu4LAxudRrH2OoJSctYh9pw3NyziKUwbpp77tsOvu" }
];

ReactDOM.render(<App items={items} />, document.getElementById('root'));