UNPKG

react-node

Version:
56 lines (41 loc) 1.06 kB
# react-node React Node is a lightweight wrapper around `React.createElement` with a few extra features. ## Installation $ npm install react-node ## Usage ```js 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. ```js 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`. ```js n('#bar') // <div id="bar"></div> n('.foo') // <div class="foo"></div> n('a.baz') // <a class="baz"></a> ``` ## License MIT