index.js
function renderToString(page) {
  var layout = null, child = null, props = {};
  while ((layout = page.type.layout || (page.defaultProps && page.defaultProps.layout))) {
    child = React.createElement(page, props, child);
    _.extend(props, page.defaultProps);
    React.renderToString(React.createElement(page, props, child));
    page = layout;
  }
  return React.renderToString(React.createElement(page, props, child));
}
function renderToString(page) {
  var layout = null, child = null, props = {};
  while ((layout = page.type.layout || (page.defaultProps && page.defaultProps.layout))) {
    child = React.createElement(page, props, child);
    _.extend(props, page.defaultProps);
    React.renderToString(React.createElement(page, props, child));
    page = layout;
  }
  return React.renderToString(React.createElement(page, props, child));
}
function renderToString ( page ) { var layout = null , child = null , props = { } ; while ( ( layout = page . type . layout || ( page . defaultProps && page . defaultProps . layout ) ) ) { child = React . createElement ( page , props , child ) ; _ . extend ( props , page . defaultProps ) ; React . renderToString ( React . createElement ( page , props , child ) ) ; page = layout ; } return React . renderToString ( React . createElement ( page , props , child ) ) ; }
Check if Page component has a layout property; and if yes, wrap the page
into the specified layout, then render to a string.
Check if Page component has a layout property ; and if yes wrap the page into the specified layout then render to a string .