Reactjs Learning--factory, component and element

Source: Internet
Author: User

When using Reactjs, we often use the following three methods:

    1. React.createfactory ()
    2. React.createclass ()
    3. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.