How to use the react-async.injectIntoMarkup function in react-async

To help you get started, we’ve selected a few react-async examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github natew / reactor-core / lib / middleware.js View on Github external
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));
      }
    );
github eiriklv / express-passport-app / helpers / react / render-markup-to-string.js View on Github external
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));
    });
};
github jonykrause / isomorphic-blog-react / lib / renderRouteComponent.js View on Github external
ReactAsync.renderComponentToStringWithAsyncState(app, function(err, markup, data) {
    if (err) return next(err);
    res.send(ReactAsync.injectIntoMarkup(markup, data, ['/js/bundle.js']));
  });
}