How to use the react-tools/build/modules/React.renderComponentToString function in react-tools

To help you get started, we’ve selected a few react-tools 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 petehunt / reactify-server-rendering / index.js View on Github external
serverRender: function(moduleName, props, bundlePath) {
    var module = require(moduleName);
    var component = module(props);
    var markup = null;
    React.renderComponentToString(component, function(m) {
      markup = m;
    });
    if (markup.indexOf('') === -1) {
      throw new Error('Must have  in the generated page to insert JS');
    }
    markup = markup.replace(
      '',
      '' +
        ''
    );
    // Get staticify CSS if it's there
    var g = eval('global'); // bypass Browserify's auto-global
    if (g.__staticify_css) {
github andreypopp / react-app / bootstrap.js View on Github external
page.bootstrap(function(err, data) {
    if (err) return cb(err);
    React.renderComponentToString(page, function(markup) {
      cb(null, markup, data);
    });
  });
}
github andreypopp / react-app / page.js View on Github external
page.bootstrap(function(err, data) {
    if (err) return cb(err);
    React.renderComponentToString(page, function(markup) {
      cb(null, markup, data);
    });
  });
}