REACT pure front end does not depend on the packaging tool code

Source: Internet
Author: User

# # #react最基础的语法和不依赖环境的纯前端免编译代码


Note: 1. Must be placed on the server and cannot be run on the file system


<!doctype html>



. login{    background-color:red;}. header{    height:30px;    Background-color:gray;}. userrole{    height:80px;    Background-color:lightcyan;}. userid{}.userpassword{}.submitbuttonenabled{    Color:blue;}. submitbuttondisabled{    Color:gray;}



Class Login extends react.component{//props type and whether it must be filled in//static Proptypes = {//};        Constructor (props) {super (props);    This.state = {userId: ', UserPassword: ', Submitenabled:false,};    } componentwillmount () {Console.log ("Componentwillmount");    } componentdidmount () {Console.log ("Componentdidmount");    } componentwillunmount () {Console.log ("Componentwillunmount");             }//event Handleclicksubmit () {if (This.state.userId.length < 1 | | This.state.userPassword.length < 1) {        Return } $.get ("Http://", function (Result) {Console.log (Result        );    }); } Handlechangeid () {this.setstate ({userid:this.refs._ref_userid.value, submitenabled:th  Is.refs._ref_userid.value.length > 0 && this.refs._ref_userpassword.value.length > 0,});  } handlechangepassword () {this.setstate ({userpassword:this.refs._ref_userpassword.value,        Submitenabled:this.refs._ref_userid.value.length > 0 && this.refs._ref_userpassword.value.length > 0,    });                }//Render method render () {return (<div classname= "Login" > <div classname= "Header" > {this.props.title} </div> <div classname= "Userrole" > {this.prop S.role} </div> <input classname= "userId" type= "text" ref= "_ref_userid" placeholder= "User name" on change={() =>this.handlechangeid ()}/> <input classname= "userpassword" type= "password" ref= "_ref_userPa ssWOrd "placeholder=" password "onchange={() =>this.handlechangepassword ()}/> <button type=" button "onClick={ () =>this.handleclicksubmit ()} classname={this.state.submitenabled? " Submitbuttonenabled ":" Submitbuttondisabled "}> login </button> </div>); }}reactdom.render (<login title= "title" role= "ddd"/&GT;, document.getElementById (' root '));



REACT pure front end does not depend on the packaging tool code

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: 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.