我喜歡在我的Meteor App上使用服務器渲染包,使用React和React-Router v4。但是,事件的onPageLoad返回一個錯誤:流星服務器渲染路線和Meteor.userId
Error running template: TypeError: Meteor.subscribe is not a function
這是對createContainer功能:
export default createContainer(() => {
const postsHandle = Meteor.subscribe('post');
const loading = !postsHandle.ready();
const postsList = Post.find({ 'draft': false }).fetch();
const listExists = !loading && !!postsList;
return {
loading,
listExists,
posts: listExists ? postsList : [],
};
}, PostList);
我不明白我怎麼能得到Meteor.subscribe上的空如果我在服務器上。
任何人有關於我的問題的想法?
謝謝社區!
服務器上沒有訂閱,只發布。您可以直接在服務器上訪問集合,並保證一切都在那裏。 –