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({
className: { // automatically use React classSet
foo: this.props.foo,
bar: this.props.bar
},
rendered: this.props.foo // div won't render if rendered === false
})
])
);
}
});
Returns a React element
- tag
String
- A React.DOM tag string - properties
Object
- An object containing the properties you'd like to set on the element - children
Array|String
- An array ofr
children or a string. This will create child elements or a text node, respectively.
Returns a React element
- component
Function
- A React.js Component class created withReact.createClass
- properties
Object
- An object containing the properties you'd like to set on the element - children
Array|String
- An array ofr
children or a string. This will create child elements or a text node, respectively.
-
rendered
Boolean
- If strictly to false, React will skip rendering the target component. -
className
String|Object
- If the className value is an object, apply React.addons.classSet() automatically.