Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function(err, markup, data) {
if (err) return next(err);
// Injects the data we have into the markup thats served
// So once the app starts in browser, it has the same data
markup = ReactAsync.injectIntoMarkup(markup, data, [props.bundle])
// Return html with optional wrapper function
res.send(wrapper(markup));
}
);
ReactAsync.renderComponentToStringWithAsyncState(renderedComponent, function(err, markup, data) {
if (!markup) {
debug(util.inspect(err));
return callback('could not render markup - check server console');
}
// add doctype to markup (not possible in jsx - so it needs to be done dirty)
markup = '' + markup;
callback(err, options.staticPage ? markup : ReactAsync.injectIntoMarkup(markup, data, clientScripts));
});
};
ReactAsync.renderComponentToStringWithAsyncState(app, function(err, markup, data) {
if (err) return next(err);
res.send(ReactAsync.injectIntoMarkup(markup, data, ['/js/bundle.js']));
});
}