lib/render-react.js
function createElement(filePath, props) {
  if (!filePath || typeof filePath !== 'string' || filePath.length === 0) {
    throw new Error('Expected filePath to be a string');
  }

  // clear the require cache if we have already imported the file (if we are watching it)
  if (require.cache[filePath]) {
    delete require.cache[filePath];
  }

  var component = require(filePath); // eslint-disable-line global-require, import/no-dynamic-require
  var element = _react2.default.createElement(component.default || component, props || {});

  return element;
}
function createElement(filePath, props) {
  if (!filePath || typeof filePath !== 'string' || filePath.length === 0) {
    throw new Error('Expected filePath to be a string');
  }

  // clear the require cache if we have already imported the file (if we are watching it)
  if (require.cache[filePath]) {
    delete require.cache[filePath];
  }

  var component = require(filePath); // eslint-disable-line global-require, import/no-dynamic-require
  var element = _react2.default.createElement(component.default || component, props || {});

  return element;
}
function createElement ( filePath , props ) { if ( ! filePath || typeof filePath !== 'string' || filePath . length === 0 ) { throw new Error ( 'Expected filePath to be a string' ) ; } // clear the require cache if we have already imported the file (if we are watching it) if ( require . cache [ filePath ] ) { delete require . cache [ filePath ] ; } var component = require ( filePath ) ; // eslint-disable-line global-require, import/no-dynamic-require var element = _react2 . default . createElement ( component . default || component , props || { } ) ; return element ; }
Requires a file containing a React component and create an instance of it
@param  {String} filePath file path to the React component to render
@param  {Object} props    properties to apply to the element
@return {Element}         the created React element
 /*! Gulp Render React | MIT License
Requires a file containing a React component and create an instance of it