私はRealsについてのpluralsightのチュートリアル(コースは少し前に作られました)を実行していますので、いくつかのものはバベルのように時代遅れです。しかし、私は私が確信している何かに遭遇した。Reactのes6クラスを持つキーの小道
警告:配列またはイテレータの各子は、一意の「キー」小文字を持つ必要があります。 App
のレンダリング方法を確認してください。
ありがとうございます。以下は
は私のアプリのコンポーネントです:
import React from 'react';
class App extends React.Component {
constructor() {
super();
this.state = {
messages: [
'hi there, how are you?',
'I am fine, and you?'
]
};
}
render() {
var messageNodes = this.state.messages.map(message => {
return (
<div>{message}</div>
);
});
return (
<div>{messageNodes}</div>
);
}
}
export default App;
一つおそらくあまりにも役立っています:https://stackoverflow.com/search?q=%5Breactjs%5D+Each+child + in + an +配列+または+イテレータ+は+ a +ユニーク+%22key%22 + propを持ちます。新しい質問をする前に検索を使用してください。 –
https://facebook.github.io/react/docs/reconciliation.htmlこれは多くのことを明確にするはずです。 –