React.createclass
Parameters: Config (object)
Create a Reactclass (component Class), the parameter is an object and must have a render property method, the method must return a closed container (within the container can be used by other open-ended containers) or null/false (which means nothing is rendered):
var Component = React.createclass ({ render:function () { returnthis. props.a==1 ? <div>123null } }); Reactdom.render ( <component a="1" />, document.body );
Note: In this method, all this will be automatically bound to the constructor of the current component at the end of the call.
React.createelement
Parameters: Type (string/reactclass), [Props (object)],[children (reactelement)]
Creates a react element of the specified type, noting that the third parameter children can be any of the react elements.
varComponent =React.createclass ({render:function () {return This. props.a==1? <p>123</p>:NULL } }); Reactdom.render (React.createelement ('Div',NULL, React.createelement ('P',NULL, React.createelement ('span',NULL,'Hello,'), React.createelement ('span',NULL,'World ,'), React.createelement (Component, {a:1})), document.body);
React.cloneelement
Parameters: Type (reactelement), [Props (object)],[children (reactelement)]
Clones and returns a new reactelement (the inner child element is also cloned), the newly returned element retains the props,ref,key of the old element, and the new props is integrated (as defined in the second argument)
React Getting started--------top level API