I'm writing a react component that renders a bootstrap carousel. I'm getting syntax warnings in my render function and for the life of me I cant figure out why.
render: function() {
var seconds = Math.floor(new Date().getTime() / 1000);
return (
<div id={'#'+this.state.carouselId+seconds} className="react-carousel carousel slide">
<ol className="carousel-indicators">
{
this.state.config.slides.map(function(slide,i) {
var active = i == this.state.config.activeSlide ? 'active' : '';
return <li data-target={'#'+this.state.carouselId+seconds} data-slide-to={i} className={active} />
}.bind(this))
}
</ol>
<div className="carousel-inner">
{
this.state.config.slides.map(function(slide,i) {
var active = i == this.state.config.activeSlide ? 'item active' : 'item';
return (
<div className={active}>
<img src={slide.url} className="img-responsive"/>
{
if(slide.caption.text!==''){
return(
<div class="container">
<div class="carousel-caption">
<h1>Welcome to your property profile!</h1>
</div>
</div>
)
}
}
</div>
)
}.bind(this))
}
</div>
<a className="left carousel-control" href={'#'+this.state.carouselId+seconds} data-slide="prev">
<span className="icon-prev" />
</a>
<a className="right carousel-control" href={'#'+this.state.carouselId+seconds} data-slide="next">
<span className="icon-next" />
</a>
</div>
);
},
Php storm shows the issue starting here:
I actually plan to break the slide out into a separate component but Id really like to know why this syntax is wrong and how to fix it.
