It’s a little bit outdated version. Here is the example: https://github.com/minhna/meteor-react-ssr/blob/master/imports/startup/server/ssr-init.js
1 Like
can you show both client and server files?
1 Like
import { FastRender } from 'meteor/staringatlights:fast-render';
// ...
FastRender.onPageLoad(async sink => {
//...
definitly works, you have probably an import problem
1 Like
This is my code…
import { FastRender } from 'meteor/staringatlights:fast-render';
Meteor.startup(() => {
FastRender.onPageLoad(async sink => {
and meteor gives an error
TypeError: FastRender.onPageLoad is not a function
The package is correctly installed still…
server
Meteor.startup(() => {
FastRender.onPageLoad(async sink => {
const context = {};
const app = ReactDOMServer.renderToString(
<StaticRouter location={sink.request.url} context={context}>
{renderRoutes()}
</StaticRouter>
);
sink.renderIntoElementById('target', app);
const helmet = Helmet.renderStatic();
sink.appendToHead(helmet.meta.toString());
sink.appendToHead(helmet.title.toString());
});
client
Meteor.startup(() => {
render(renderRoutes(), document.getElementById('target'));
});