react-node

1.0.2 • Public • Published

react-node

React Node is a lightweight wrapper around React.createElement with a few extra features.

Installation

$ npm install react-node

Usage

var React = require('react');
var n = require('react-node');
var Link = require('..');
 
var App = React.createClass({
  displayName: 'App',
 
  render: function() {
    return (
      n('.foo', {
        ref: 'foo'
      }, [
        n(Link, {
          onClick: ...
        }, 'Bar')
      ])
    );
  }
});

Documentation

React Node is smart enough to know when you pass in props, children, both, or none at all. So you don't have to worry about passing in any empty props just to render a component.

n(<tag or component>, <props>, <children>)
n(<tag or component>, <children>)
n(<tag or component>, <props>)
n(<tag or component>)

You can also specify classes and id's on your tags. If you omit the tag, it will default to div.

n('#bar')  // <div id="bar"></div>
n('.foo')  // <div class="foo"></div>
n('a.baz') // <a class="baz"></a>

License

MIT

/react-node/

    Package Sidebar

    Install

    npm i react-node

    Weekly Downloads

    61

    Version

    1.0.2

    License

    MIT

    Last publish

    Collaborators

    • darylginn