Skip to content

Instantly share code, notes, and snippets.

@DZuz14
Created January 29, 2017 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DZuz14/9cb723530d531ce485da076f31716ee7 to your computer and use it in GitHub Desktop.
Save DZuz14/9cb723530d531ce485da076f31716ee7 to your computer and use it in GitHub Desktop.
Slider with conditionals added
import React, { Component } from 'react';
import SlideOne from './SlideOne';
import SlideTwo from './SlideTwo';
import SlideThree from './SlideThree';
export default class Slider extends Component {
constructor(props) {
super(props);
this.state = {
slideCount: 1
}
}
render() {
return (
<div className="slider">
{/* Slides go here */}
{ this.state.slideCount === 1 ? <SlideOne /> : null }
{ this.state.slideCount === 2 ? <SlideTwo /> : null }
{ this.state.slideCount === 3 ? <SlideThree /> : null }
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment