How to use the react-tools/build/modules/ReactMount.allowFullPageRender 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
var React = require('react-tools/build/modules/React');
var ReactMount = require('react-tools/build/modules/ReactMount');

ReactMount.allowFullPageRender = true;

var index = {
  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(
      '',
      '' +
        '
github andreypopp / react-app / app.js View on Github external
"use strict";

var qs                    = require('querystring'),
    ReactMount            = require('react-tools/build/modules/ReactMount'),
    createRouter          = require('./router'),
    page                  = require('./page'),
    renderPageToString    = page.renderPageToString,
    renderPage            = page.renderPage;

ReactMount.allowFullPageRender = true;

/**
 * Create an application object from spec
 */
module.exports = function(spec) {
  return new Application(spec);
}

/**
 * Application
 *
 * @param {Object} spec
 */
function Application(spec) {
  this.spec = spec;
  this.routes = this.spec.routes;
github andreypopp / react-app / bootstrap.js View on Github external
/**
 * Bootstrap code which initialise root component.
 *
 * 2013 (c) Andrey Popp <8mayday@gmail.com>
 */
"use strict";

var ReactMount = require('react-tools/build/modules/ReactMount'),
    React = require('react-tools/build/modules/React');

ReactMount.allowFullPageRender = true;

function _renderPage(page, doc, cb) {
  if (doc.readyState === 'interactive' || doc.readyState === 'complete')
    cb(null, React.renderComponent(page, doc));
  else
    window.addEventListener('DOMContentLoaded', function() {
      cb(null, React.renderComponent(page, doc));
    });
}

function renderPage(page, doc, cb) {
  page.bootstrap(function(err, data) {
    if (err) return cb(err);
    _renderPage(page, doc, function(err, page) {
      cb(err, page, data); 
    });