title: Set TimeOut to React Function
body: <p>I have the following object list:</p>
  
  <pre><code>mediaList[
   {id:1, url:"www.example.com/image1", adType:"image/jpeg"},
   {id:2, url:"www.example.com/image2", adType:"image/jpg"},
   {id:3, url:"www.example.com/video1", adType: "video/mp4"}
  ]
  </code></pre>
  
  <p>I need to create a slideshow that has a configurable duration (1s, 5, 10s). 
  So far I can generate a list of the media from the <code>mediaList</code></p>
  
  <pre><code>  renderSlideshow(ad){
      let adType =ad.adType;
      if(type.includes("image")){
        return(
          &lt;div className="imagePreview"&gt;
            &lt;img src={ad.url} /&gt;
          &lt;/div&gt;
        );
      }else if (adType.includes("video")){
        return(
          &lt;video className="videoPreview" controls&gt;
              &lt;source src={ad.url} type={adType}/&gt;
            Your browser does not support the video tag.
          &lt;/video&gt;
        )
  
      }
    }
  
   render(){   
      return(
        &lt;div&gt;
            {this.props.mediaList.map(this.renderSlideshow.bind(this))}
        &lt;/div&gt;
      )
   }
  </code></pre>
  
  <p>What I want to do now is generate the media one at a time with configurable durations for autoplay. </p>
  
  <p>I know I need to use some form of a setTimeout function like this example: </p>
  
  <pre><code>setTimeout(function(){
           this.setState({submitted:false});
      }.bind(this),5000);  // wait 5 seconds, then reset to false
  </code></pre>
  
  <p>I'm just not sure how to implement it for this scenario. (I believe I'll need to use css for the fade transitions but I'm just stumped on how to create the transition in the first place)</p>