Meteorのサーバレンダリングパッケージを使用していますが、TypeErrorを取得しています。Meteor.subscribeは関数ではありません。この出来事または何がここMeteorサーバでMeteorサーバをレンダリングする際のTypeError反応ルータv4で
正確に間違っている理由を把握することは、クライアント上の私のコードです:
import React from 'react';
import { Meteor } from 'meteor/meteor';
import { render } from 'react-dom';
import {RenderRoutes} from '../imports/api/routes.jsx'
import { onPageLoad } from 'meteor/server-render';
import ReactDOM from 'react-dom';
import {
Router,
Route,
Link,
Switch
} from 'react-router-dom'
import createBrowserHistory from 'history/createBrowserHistory'
const history = createBrowserHistory()
const Application =() => (
<Router history={history}>
<RenderRoutes/>
</Router>
);
onPageLoad(()=> {
ReactDOM.render(<Application/>, document.getElementById('react-root'));
});
、サーバー上:
onPageLoad((sink) => {
const context = {};
const App = props => (
<StaticRouter location={props.location} context={context}>
<RenderRoutes/>
</StaticRouter>
);
sink.renderIntoElementById('app', renderToString(<App location=
{sink.request.url} />));
});
私ができました上記を使用して、非常に簡単なアプリケーションを正しく動作させるには、エラーを取り込むサブスクリプションとcreatecontainerがあります。それらを処理する別の方法はありますか?あなたは何が起こっているかを把握することができればそれは素晴らしいことだ
export default createContainer(() => {
const handle1 = Meteor.subscribe('categories');
const handle2 = Meteor.subscribe('subcategories');
const handle3 = Meteor.subscribe('products');
const isReady1 = handle1.ready()
const isReady2 = handle2.ready()
const isReady3 = handle3.ready()
return {
products: isReady3 ? Products.find({}).fetch() : [],
categories: isReady1 ? Categories.find({}).fetch() : [],
subcats: isReady2 ? SubCategories.find({}).fetch(): [],
};
}, B2C);
または私はすべてのサブスクリプションを削除した後 おかげ