Skip to main content

React Classes

class Human {
constructor() {
this.gender = 'male'
}

printGender() {
console.log(this.gender)
}
}

class Person extends Human {
constructor() {
super()
this.name = 'Max'
this.gender = 'female'
}

printMyName() {
console.log(this.name)
}
}

const person = new Person()
person.printMyName()
person.printGender()

As you can see the Docusaurus live editor works fine with es6 standard. About restrictions of arrow function read developer.mozilla.org.

Live Editor
Result
Loading...