ProfileCandidate
というコレクションからユーザーの詳細を読み込むコンテナを作成しようとしています。私はpropTypeを使用していますが、何が間違っているのか分かりません。 propTypeが空のオブジェクトを読み込むので、ロードオーダーエラーだと思います。私はprofileCandidate.private
リクエストを購読しているので、コンテナが実行中であることを知っています。PropTypeが設定されていません
パス:非同期components/ContactDetails.js
class ContactDetails extends React.Component {
constructor(props) {
super(props);
var ProfileCandidate = this.props.profileCandidate;
console.log("ProfileCandidate: ", this.props.profileCandidate);
};
}
ContactDetails.propTypes = {
profileCandidate: React.PropTypes.object.isRequired,
};
export default createContainer(() => {
Meteor.subscribe('profileCandidate.private');
var test = ProfileCandidate.findOne({userId: Meteor.userId()});
console.log("test: ", test);
return {
profileCandidate: ProfileCandidate.findOne({userId: Meteor.userId()}) || {},
};
}, ContactDetails)
ビューをレンダリングしようとしましたか?パブリケーションにクライアントにデータを送信する時間がないため、コンポーネントの構築時に空のオブジェクトが取得されることが予想されます。あなたのコンストラクタの 'props'が、コンテナが再実行された後、後で'レンダリング 'できるデータを含めることを期待しないでください。 – MasterAM