Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

react-render

Build Status

Handles the simple use case of loading in a component and rendering it to markup.

The renderer will attempt to avoid React version incompatibilities by resolving a path from your component to the local React package.

Installation

npm install react-render

Usage

var reactRender = require('react-render');

reactRender({

  // An absolute path to a module exporting your component
  path: '/abs/path/to/component.js',

  // Optional
  // --------

  // A string containing a JSON-serialized object which will be used
  // during rendering
  serialisedProps: '...',

  // An object which will be used during rendering
  props: {},

  // A flag indicating if you wish to render the component to static
  // markup. Defaults to false.
  toStaticMarkup: true

  // An absolute path that can be used to load the version of React.
  // If the renderer can not find React from the component's path, you
  // can specify it.
  pathToReact: '...'

}, function(err, markup) {
  if (err) throw err;

  console.log(markup);
});