ӭĸ˲վ!

վ-˲-ռ

˲վ

עĸ˲վ

ҳ > WEB > JavaScript >

ѧreact.js֮ǰҪѧʲô

ʱ䣺2019-05-25  ༭˲վ      

ڸ˽ React ĹеóһۣReact ȫǹ JavaScript ġңкܶǹ JavaScript React

 

ѧreact.js֮ǰҪѧʲô

д󲿷 JavaScript ES6 Ժ﷨Ԫ򻯵﷨this JavaScript úmapreducefilterһĸԡԡԻ߽׺ڸտʼӴ React ֮ǰܲҪЩ֪ʶѧϰʵп϶Ҫõǡ

React JavaScript

React Ҫõй JavaScript ֪ʶJavaScript ĸԽ¡֮ǰֻ JavaScript ԭʵּ̳СJavaScript ԭͼ̳Ϊü̳ϵø򵥡

React һַʹ JavaScript ࡣ

class Developer {
 constructor(firstname, lastname) {
   this.firstname = firstname;
   this.lastname = lastname;
 }
 getName() {
   return this.firstname + ' ' + this.lastname;
 }
}
var me = new Developer('Robin', 'Wieruch');
console.log(me.getName());

һһʵ壬ڴʵʵʹ new 䴴ʵʱĹ캯ͨλڹ캯С⣬෽ getName()ڶȡд룩ʵݡʵʹ this ʾⲿָ JavaScript

Уͨʵּ̳С JavaScript Ҳһextends һ̳һࡣһͨ extends ̳һйܣԼĹܡ

class Developer {
 constructor(firstname, lastname) {
   this.firstname = firstname;
   this.lastname = lastname;
 }
 getName() {
   return this.firstname + ' ' + this.lastname;
 }
}
class ReactDeveloper extends Developer {
 getJob() {
   return 'React Developer';
 }
}
var me = new ReactDeveloper('Robin', 'Wieruch');
console.log(me.getName());
console.log(me.getJob());

Ͼѧreact.js֮ǰҪѧʲôϸݣע£

ĵַhttp://itbyc.com/web/javascript/21035.html
תע
һֿ֣Ҳһ:
ҳ | WEB | վӪ | CMSʹý̳ ICP14002061-1