Fix React key warnings

The number of warnings was locking up my browser, making it hard to test things out.
This commit is contained in:
Ray Schamp 2017-02-20 11:04:41 -05:00
parent 6a733a33f2
commit d6093f19b0
2 changed files with 7 additions and 5 deletions

View file

@ -27,12 +27,12 @@ var Grid = React.createClass({
return (
<div className={classes}>
<FlexRow>
{this.props.items.map(function (item) {
{this.props.items.map(function (item, key) {
var href = '/' + this.props.itemType + '/' + item.id + '/';
if (this.props.itemType == 'projects') {
return (
<Thumbnail key={item.id}
<Thumbnail key={key}
showLoves={this.props.showLoves}
showFavorites={this.props.showFavorites}
showRemixes={this.props.showRemixes}
@ -53,7 +53,7 @@ var Grid = React.createClass({
}
else {
return (
<Thumbnail key={item.id}
<Thumbnail key={key}
type={'gallery'}
href={href}
title={item.title}

View file

@ -75,10 +75,12 @@ var Thumbnail = React.createClass({
}
var imgElement,titleElement,avatarElement;
if (this.props.linkTitle) {
imgElement = <a className="thumbnail-image" href={this.props.href}>
imgElement = <a className="thumbnail-image" href={this.props.href} key="imgElement">
<img src={this.props.src} alt={this.props.alt} />
</a>;
titleElement = <a href={this.props.href}>{this.props.title}</a>;
titleElement = <a href={this.props.href} key="titleElement">
{this.props.title}
</a>;
} else {
imgElement = <img src={this.props.src} />;
titleElement = this.props.title;