Fix React.js warning by adding unique "key" prop

This commit is contained in:
Yuya Ochiai 2016-03-30 23:03:43 +09:00
parent 6dcf88b885
commit 001a65f5eb

View file

@ -144,8 +144,9 @@ var MainPage = React.createClass({
var handleNotificationClick = function() {
thisObj.handleSelect(index);
}
return (<MattermostView id={ 'mattermostView' + index } style={ thisObj.visibleStyle(thisObj.state.key === index) } src={ team.url } name={ team.name } onUnreadCountChange={ handleUnreadCountChange } onNotificationClick={ handleNotificationClick }
/>)
var id = 'mattermostView' + index;
return (<MattermostView key={ id } id={ id } style={ thisObj.visibleStyle(thisObj.state.key === index) } src={ team.url } name={ team.name } onUnreadCountChange={ handleUnreadCountChange }
onNotificationClick={ handleNotificationClick } />)
});
var views_row = (<Row>
{ views }
@ -189,7 +190,8 @@ var TabBar = React.createClass({
</Badge>);
}
return (<NavItem className="teamTabItem" id={ 'teamTabItem' + index } eventKey={ index }>
var id = 'teamTabItem' + index;
return (<NavItem className="teamTabItem" key={ id } id={ id } eventKey={ index }>
{ team.name }
{ ' ' }
{ badge }