React Study notes 2

Source: Internet
Author: User

<div class= "Container" id= "Demo" ></div>
<script type= "Text/babel" >//this is Text/babel.

var cpnt1=react.createclass ({//First letter uppercase, otherwise not rendered, but no error
Render:function () {
Return (
<div>
<p>{this.props.title}</p>//{title} writes this to the title variable on the current scope, {This.props.title} takes the title value in the current component's properties

This write will be error, title is not defined just at the beginning I thought it was wrong, carefully examined, did not find where the wrong, ES6 Grammar does not support??? Later found is because of the comments in the back of the resulting, notes, seemingly in the JSX comments can not be used freely

<input type= "text" value= ""/>//single label to be closed
<input type= "button" Value={this.props.btnname}/>
</div>
)
}
}
)
var obj={title: "Hello", Btnname: "Release"};
Reactdom.render (<cpnt1 {... obj}/>,// This is the syntax of ES6, let the property take the value of obj
Document.queryselector (' #demo '),
function () {

})
</script>

React Study notes 2

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.