Ful Example About how to use classes with react

PHOTO EMBED

Thu Jul 11 2024 19:11:39 GMT+0000 (Coordinated Universal Time)

Saved by @Black_Shadow #javascript #react.js #html #output #text

<!DOCTYPE html>
<html>
​
<body>
  
<script>
class Car {
  constructor(name) {
    this.brand = name;
  }
​
  present() {
    return 'I have a ' + this.brand;
  }
}
​
class Model extends Car {
  constructor(name, mod) {
    super(name);
    this.model = mod;
  }  
  show() {
    return this.present() + ', it is a ' + this.model
  }
}
​
const mycar = new Model("Ford", "Mustang");
document.write(mycar.show());
</script>
​
</body>
</html>
​
content_copyCOPY

https://www.w3schools.com/react/tryit.asp?filename