我是新来的反应js。 当我添加这段代码时,它隐藏了nav标签 运动!== SPORTS.monthly&&
你能告诉我为什么...... 它也不在里面如果条件...... 那怎么样呢?rendergraph(sport, sportKey, data) {
let componentToRender = null;
switch (sport) {
case SPORTS.yearly:
componentToRender = (<YearlyDataValues DataValuess={data}/>);
break;
case SPORTS.monthly:
componentToRender = (<MonthlyDataValues DataValuess={data}/>);
break;
case SPORTS.quarterly:
componentToRender = (<QuarterlyDataValues DataValuess={data}/>);
break;
case SPORTS.all:
componentToRender = (<AllDataValues DataValuess={data}/>);
break;
default:
componentToRender = null;
}
return (
<div>
{componentToRender}
{ sport !== SPORTS.monthly &&
(<nav className="graph-nav">
{this.renderPrevious(sport, sportKey)}
{
// render only if we have data in the store
this.dataForRenderer({
sport,
sportKey: moment(sportKey).add(1, sport.period.toLowerCase()).toDate()
}) &&
this.renderNext(sport, sportKey)
}
</nav>)
}
</div>
);
},