When using Reactjs, we often use the following three methods:
- React.createfactory ()
- React.createclass ()
- React.cleateelement ()
The three methods accept parameters that are different from the object types that are returned.
react.createfactory
the method accepts an object of type component and returns a factory method. Use the returned factory to create an element. As
<span style= "FONT-SIZE:12PX;" >var factory = react.createfactory (component); var element = factory (props, .... Children);</span>
React.createclass
the method returns a component.
react.cleateelement
returns an element
If the instantiation is not called by the corresponding type, react throws a warning, which is said to throw an error in the next version.
PS:I wrote a project seed, the framework uses backbone + React + Requirejs, the UI framework uses the semantic UI, and a small partner who can flip the wall can refer to it. Https://github.com/gaoyuan-mountain/framework-project-seed/tree/master/react-backbone
waiting to be perfected ...
Reactjs Learning--factory, component and element