最新版在{imgFigures}操作時報錯
一直報錯 ---- Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `AppComponent`. See https://fb.me/react-warning-keys for more information. 我用的是最新版,這是為什么?
一直報錯 ---- Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `AppComponent`. See https://fb.me/react-warning-keys for more information. 我用的是最新版,這是為什么?
2016-08-11
舉報
2016-08-13
這只是個警告,你渲染出來的系列的組件需要加一個key={"XXX"+i},這樣react就知道每個child的不同了,不寫的話可能會影響性能,所以react給了警告
2016-08-17
react組件中,每個標簽都會有一個唯一的編號data-reactid,如:data-reactid=".0.$0a.0.1.0.1.1"。這里的key是data-reactid的最后一個小數(shù)點后面的值。所以key只需要在自己兄弟節(jié)點內(nèi)唯一即可。如果不按照要求,讓多個子元素的key相同,那么只會識別展示第一個子元素。