1.2.0 • Published 9 years ago

react-render-loader v1.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

npm version

React render loader for webpack

A webpack loader that renders React components to HTML strings.

Warning: This loader executes your module in a Node context, use browser api will cause errors.

Usage

// App.js
import React from 'react';

function Hello(props) {
  return <h1>Hello {props.name}</h1>;
}

const App = <Hello name="React" />;

export default App;



// index.js

// Use ReactDOMServer.renderToString
import AppHtml from 'react-render!./App.js';

// Use ReactDOMServer.renderToStaticMarkup
// import AppHtml from 'react-render?static=true!./App.js';

document.getElementById('root').innerHTML = AppHtml;

This loader supports

  • React class
  • React element
  • Stateless functional components
  • Array of above
  • Array of above (sub arrays)

See basic example for demo.

1.2.0

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago