Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of GalleryByReactApp. See https://fb.me/react-warning-keys for more information.
b
請(qǐng)有大神知道這兩條報(bào)錯(cuò)的原因么?
render:?function?()?{ ????var?imgFigures?=?[], ????????controllerUnits?=?[]; ????imageDatas.forEach(function?(value,?index)?{ ????????if?(!this.state.imgsArrangeArr[index])?{ ????????????this.state.imgsArrangeArr[index]?=?{ ????????????????pos:?{ ????????????????????left:?0, ????????????????????top:?0 ????????????????} ????????????}; ????????} ????????imgFigures.push(<ImgFigure?data={value}?ref={'imgFigure'?+?index}?arrange={this.state.imgsArrangeArr[index]}/>); ????}.bind(this)); ????return?( ????????<section?className="stage"?ref="stage"> ????????????<section?className="img-sec"> ????????????????{imgFigures} ????????????</section> ????????????<nav?className="controller-nav"> ????????????????{controllerUnits} ????????????</nav> ????????</section> ????); }
2017-04-20
給<ImgFigure>標(biāo)簽中加一個(gè)key={index} ?就好了