hexo-renderer-react

1.1.0 • Public • Published

hexo-renderer-react

Render ES6 React components as hexo templates

npm Version Dependency Status Dev Dependency Status

JS Standard Style MIT License

Install

$ npm install hexo-renderer-react react react-dom --save

This requires you to have react installed as well.

Usage

Examples

layout.jsx

import React from 'react';
 
export default class extends React.Component {
  render() {
    return (
      <html>
        <head>
          <title>{this.props.page.title}</title>
        </head>
        <body>
          <main dangerouslySetInnerHTML={{__html: this.props.page.body}} />
        </body>
      </html>
    );
  }
}

post.jsx

import React from 'react';
 
export default class extends React.Component {
  render() {
    return (
      <div>
        <h3>POST: {this.props.page.title}</h3>
        <div>{this.props.page.date.toString()}</div>
      </div>
    )
  }
}

License

This software is free to use under the MIT license. See the LICENSE-MIT file for license text and copyright information.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    1
  • 1.0.1
    0
  • 1.0.0
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i hexo-renderer-react

Weekly Downloads

1

Version

1.1.0

License

MIT

Last publish

Collaborators

  • thetalecrafter