オブジェクトは有効ではありません<p>私は同じエラーメッセージで質問があることを認識していますが、私の問題の解決策を見つけることができないようです。</p>
render: function() {
return (
{this.state.daily.map(day => {
return (
<div key={day.time} className="key col-md-12">
<div className="col-md-3">{this._getTime(day.time)}</div>
</div>
);
);
},
に使用されている
_getTime(time) {
var dateTime = new Date(time*1000);
console.log(dateTime);
return dateTime
},
Unixタイムスタンプから日付を計算する関数は、このInvariant Violation: Objects are not valid as a React child (found: Thu Oct 20 2016 00:00:00 GMT+0200 (CEST)). If you meant to render a collection of children, use an array instead or wrap the object using createFragment(object) from the React add-ons. Check the render method of
返してきた
のApp .
あなたは日付をレンダリングしようとしているが、divの –
内.toStringを()を使用して、最初の文字列に変換してみてくださいその働いた。ありがとうたくさん:) – frisk0
問題はありません!私はそれがうまくいった –