I really have problems understanding React logic. Why is this IF not working? You can assume that there are all classes, and the loop also works. Well, even the condition seems to work, but the output on my page is still empty .....
var Feature = React.createClass({
componentDidMount: function(){
$('input.rating[type=number]').rating();
initFeatureInstallReady(this.props.feature.feature_id);
},
render: function(){
var backgroundColor = "white";
var item;
var props = this.props;
this.props.feature.slides.map(function(slide, i){
if(props.feature.feature_id == "start-home-away" && slide.slide_id == 'review'){
item = <div className={i == 0 ? "item active" : "item"} key={i} id={slide.slide_id}>
<FeatureReviewHomeAway feature={props.feature} slide={slide} />
</div>;
}else if(props.feature.feature_id == "start-goto-sleep" && slide.slide_id == 'review'){
item = <div className={i == 0 ? "item active" : "item"} key={i} id={slide.slide_id}>
<FeatureReviewHomeAway feature={props.feature} slide={slide} />
</div>;
}else{
item = <div className={i == 0 ? "item active" : "item"} key={i} id={slide.slide_id}>
<FeatureMain_Step feature={props.feature} slide={slide} />
</div>;
}
});
return (
<div className="carousel slide carousel-feature" data-ride="" data-interval="false" id={this.props.feature.feature_id}>
<div className="carousel-inner" role="listbox" style={{backgroundColor: backgroundColor}}>
{item}
</div>
</div>
);
}
});
Please help me because I really don't understand him
source
share