React DOM wrapper.
var React = require('react');
var r = require('r-dom');
var AnotherComponent = require('./another-component');
module.exports = React.createClass({
render: function render() {
return (
r.div({className: 'example'}, [
r.h1('Hello World!'),
r.h2('This is React.js markup'),
r(AnotherComponent, {foo: 'bar'}),
r.div({
classSet: { // Automatically use `classnames` module for classSet
foo: this.props.foo,
bar: this.props.bar
},
isRendered: this.props.foo // div won't render if isRendered is falsy
})
])
);
}
});
r[tag]([properties], [children])
Returns a React element
String
- A React.DOM tag stringObject
optional - An object containing the properties you'd like to set on the element.Array|String
optional - An array of r
children or a string. This will create child elements or a text node, respectively. r(component, [properties], [children])
Returns a React element
Function
- A React.js Component class created with React.createClass
Object
optional - An object containing the properties you'd like to set on the element.Array|String
optional - An array of r
children or a string. This will create child elements or a text node, respectively. "Boolean"
optional - If falsy, React will skip rendering the target component.Object
optional - Apply classnames and assign to className.